simplesamlphp/assert
Fork of webmozart/assert that lets every assertion throw your chosen exception (or a default AssertionFailedException) instead of always InvalidArgumentException. Adds a few custom assertions aimed at XML/SAML2 use cases.
if (!in_array($status, ['active', 'inactive']))) by leveraging assert::isEnum($value, Status::class). Reduces cognitive load and boilerplate for teams adopting PHP 8.1+ enums.Adopt if:
Status::class, Role::class).Validator (e.g., nested arrays, callbacks, or custom types).Look elsewhere if:
FormRequest or Validator facade instead).For Executives:
"This updated package now supports PHP 8.1+ enums and stricter regex validation, giving us tighter control over data integrity in our Laravel services. For example, we can now validate that a user’s Status field is always one of the allowed enum values—without manual checks—while also blocking risky input like newlines in sensitive fields. This reduces bugs, improves security, and future-proofs our codebase for modern PHP features. It’s a lightweight, open-source solution that pays dividends in developer productivity and reliability."
For Engineering:
*"We’re upgrading to v1.5.0 of simplesamlphp/assert to leverage two key improvements:
if (!in_array($status, [...]))) with clean assertions:
assert::isEnum($user->status, Status::class);
How can I help you explore Laravel packages today?