Download the PHP package nilportugues/assert without Composer
On this page you can find all versions of the php package nilportugues/assert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nilportugues/assert
More information about nilportugues/assert
Files in nilportugues/assert
Package assert
Short Description A simple and elegant assertion and guard methods library for input validation.
License MIT
Homepage http://nilportugues.com
Informations about the package assert
Assert
While I know there are out there other assertion libraries I was unhappy with them, so I wrote my own.
Usage
Assertion library is really straight forward. Pass input to the method call and it will just run or throw an \Exception
if it doesn't meet the requirements.
Assertion Methods
All assertion methods can be used against different data types (integer, double, objects..).
If you try to validate data for an unexpected data type, an Exception will be thrown making your assertion fail as expected.
Most methods can be called using the "nullOr" prefix instead of the "is" prefix. For instance:
Assertion List
All methods allow specifying a custom $message
value. If not passed in, a library-defined default will be used.
Those accepting a callable
as an argument, expect an Assert statement to be used inside the callable.
Generic Assertions
String Assertions
Integer Assertions
Float & Double Assertions
Array & Collection Assertions
DateTime Assertions
Object Assertions
FileUpload Assertions
FileUpload Assertions look into the $_FILES
global variable.
Contribute
Contributions to the package are always welcome!
- Report any bugs or issues you find on the issue tracker.
- You can grab the source code at the package's Git repository.
Support
Get in touch with me using one of the following means:
- Emailing me at [email protected]
- Opening an Issue
Authors
License
The code base is licensed under the MIT license.