beberlei/assert
Lightweight assertion library for validating method arguments and input data in PHP. Provides a fluent, readable API with many built-in rules (string, numeric, email, UUID, collection, etc.), clear exceptions, and easy extensibility for custom constraints.
[@method](https://github.com/method) return type for Assert\LazyAssertion methods to show that the return type is LazyAssertion.Assert\Assertion::stringify() UTF-8 safe (Thanks to Pedram Azimaei)Assert\Assertion::all() helper to show that the value is expected to be an array.\Assert\Assertion::createException() signature to 3.2.2.Assert\Assertion::count(),
Assert\Assertion::isCountable(), Assert\Assertion::minCount(), and Assert\Assertion::maxCount() will operate on
ResourceBundles.[@method](https://github.com/method) return type for Assert\LazyAssertion methods to show that the return type is static for
extensions of Assert\LazyAssertion.[@method](https://github.com/method) whose returns type is of
the subclass and a [@method](https://github.com/method) that is called statically (PSR-5#899).
So the use of static static is a fudge that sort of works for IDEs that need to know about the method that MAY be
overridden in a subclass.Assertion::eqArraySubset() (Thanks to Anna Filina)Assert\Assertion::url() (Thanks to Christophe Histaesse)Assert\Assertion::url() (Thanks to Menno Holtkamp)Assert\Assertion::NullOrXxxx() to show that the first parameter can be null.Assert\LazyAssertion to show that the return type is $this to aid IDE's static analysis.Assert\Assertion::url() (Thanks to Christophe Histaesse)Assert\Assertion::url() (Thanks to Menno Holtkamp)Assertion::isCountable() (Thanks to Baptiste Clavié)Assertion::maxCount() (Thanks to Baptiste Clavié)Assertion::minCount() (Thanks to Baptiste Clavié)Assertion::nonContains() (Thanks to Baptiste Clavié)\ResourceBundle and \SimpleXMLElement to Assertion::count().Assert\Assertion::notEq(), Assert\Assertion::notSame(), and Assert\Assertion::notInArray() (Thanks to Rick Kuipers)Assertion::notRegex() (Thanks to Thomas Müller)Assert\Assertion::url() to latest from Symfony/ValidatorAssertionFailedException must be a Throwable (Thanks to Marco Pivetta)\Assert\Assertion::count() to include the supplied count (Thanks to Yoann Blot)\Assert\Assertion::generateMessage() will now receive the default message for an assertion if one is not supplied (Thanks to Romans Malinovskis)Assertion::integerish() has had several issues in the last couple of versions.\Assert\that(), \Assert\thatAll(), \Assert\thatNullOr(), and \Assert\lazy() are no longer marked as deprecated.Assertion::integerish() now correctly asserts integers with leading zeros in strings (Thanks to Albert Casademont)Assertion::integerish(0) and Assertion::integerish('0') now assert correctly.Assertion::base64() (Thanks to Pablo Kowalczyk)Assertion::integerish() now throws exception as expected (Thanks to Thomas Flack)Assert\Assertion:isResource() (Thanks to Timothy Younger)Assert\Assertion::propertiesExist().Assert\Assertion::objectOrClass() (Thanks to Timothy Younger)Assert\Assertion::propertyExists() (Thanks to Timothy Younger)Assert\Assertion::propertiesExist() (Thanks to Timothy Younger)Assert\Assertion::integerish() when used with a resource (Thanks to manuxi)Assert\Assertion::extensionVersion() (Thanks to Timothy Younger)Assert\Assertion::phpVersion() (Thanks to Timothy Younger)Assert\Assertion::version() (Thanks to Timothy Younger)Assert\Assertion::defined() (Thanks to Timothy Younger)Assert\Assertion::extensionLoaded() (Thanks to Timothy Younger)\Assert\InvalidArgumentException (Thanks to Richard Quadling)\Assert\that(), \Assert\thatAll(), \Assert\thatNullOr() and \Assert\lazy()) are now marked as deprecated.
They will be removed in the next major release.
They have been replaced with the static methods \Assert\Assert::that(), \Assert\Assert::thatAll(), \Assert\Assert::thatNullOr() and \Assert\Assert::lazy()Assert\Assertion::between()Assert\Assertion::betweenExclusive()http://localhost as a valid URL - fixes Assertion::url('http://localhost') not a valid url?Assert\Assertion::url() to latest from Symfony/ValidatorAssert\Assertion::e164() - The international public telecommunication numbering planAssert\Assertion::interfaceExists()Assert\Assertion::ip() / Assert\Assertion::ipv4() / Assert\Assertion::ipv6()Assert\Assertion::keyNotExists()Assert\Assertion::null()Assert\Assertion::satisfy() - Allows for a bespoke assertion, rather than a predefined onecomposer.lock file from libraryAssert\Assertion::notInArray()Assert\Assertion::INVALID_GREATER_OR_EQUAL uniqueAssertion::isCallable() to with with PHP 5.3Assert\Assertion::isCallable()generate_method_docs.php and regenerated all documentationAssert\Assertion::date()Assert\Assertion::isTraversable()Assert\Assertion::isArrayAccessible()Assert\Assertion::keyIsset()sprintf() for messagesAssert\Assertion::notEq()Assert\Assertion::notSame()Assert\Assertion::scalar()Assert\Assertion::choicesNotEmpty()Assert\Assertion::methodExists()Assert\Assertion::isObject()Assert\Assertion::lessThan()Assert\Assertion::lessOrEqualThan()Assert\Assertion::greaterThan()Assert\Assertion::greaterOrEqualThan()Assert\AssertionFailedExceptionAssert\Assertion::stringify() to make a string version of a valueAssert\Assertion::float()Assert\Assertion::count()Assert\Assertion::notEmptyKey()Assert\Assertion::all....()Assert\Assertion::noContent()Assert\Assertion::endsWith()Assert\Assertion::notIsInstanceOf()Assert\Assertion::isJsonString()Assert\Assertion::uuid()Assert\Assertion::length()Assert\Assertion::url()Assert\Assertion::false()Assert\Assertion::implementsInterface()Assert\InvalidArgumentException$encoding = 'UTF-8' parameter to appropriate assertionsAssert\Assertion::nullOr....()Assert\Assertion::eq()Assert\Assertion::same()Assert\Assertion::inArray()Assert\Assertion::min()Assert\Assertion::max()Assert\Assertion::true()Assert\Assertion::classExists()$propertyPath = null parameter to assertionsAssert\Assertion::integer()Assert\Assertion::digit()Assert\Assertion::integerish()Assert\Assertion::boolean()Assert\Assertion::notEmpty()Assert\Assertion::string()Assert\Assertion::regex()Assert\Assertion::minLength()Assert\Assertion::maxLength()Assert\Assertion::betweenLength()Assert\Assertion::startsWith()Assert\Assertion::contains()Assert\Assertion::choice()Assert\Assertion::isArray()Assert\Assertion::keyExists()Assert\Assertion::notBlank()Assert\Assertion::isInstanceOf()Assert\Assertion::subclassOf()Assert\Assertion::range()Assert\Assertion::file()Assert\Assertion::readable()Assert\Assertion::writeable()Assert\Assertion::email()Assert\Assertion::alnum()How can I help you explore Laravel packages today?