wikimedia/assert
A lightweight PHP assertion library from Wikimedia providing methods for parameter type checks, preconditions, postconditions and invariants. Enforce contracts and validate input in MediaWiki-style projects with clear, descriptive exceptions and no extra dependencies.
wikimedia/assert is a lightweight PHP library for defensive programming, providing a simple Assert class to validate preconditions and invariants. It lets you fail fast with clear exceptions instead of letting invalid data silently propagate through your code.
Each assertion throws a dedicated exception on failure, making errors easy to catch and diagnose. The package is dependency-free and integrates cleanly into any PHP project.
Assert::parameterType(), Assert::integer(), Assert::string())AssertionException and subclassesHow can I help you explore Laravel packages today?