Download the PHP package kilbiller/jarvis without Composer
On this page you can find all versions of the php package kilbiller/jarvis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download kilbiller/jarvis
More information about kilbiller/jarvis
Files in kilbiller/jarvis
Download kilbiller/jarvis
More information about kilbiller/jarvis
Files in kilbiller/jarvis
Vendor kilbiller
Package jarvis
Short Description A simple but powerful way to validate data in PHP.
License MIT
Package jarvis
Short Description A simple but powerful way to validate data in PHP.
License MIT
Please rate this library. Is it a good library?
Informations about the package jarvis
Jarvis
A simple but powerful way to validate data in PHP.
Requires php >= 7.0
Why ?
I needed to be able to make complex validation logic easily and to get a nicely formatted array with the validation errors associated with their keys. I couldn't find anything that satisfied these requirements so I made Jarvis.
Features
- Fluent interface
- Treats custom validation logic as first class citizen. They're just functions !!
- Get validation errors in a simple array, each error is associated to the input name. Only the first error for each field is kept.
Api
Validator
Example
Built-in rules
- between(min, max)
- isBoolean()
- isDate(format = 'Y-m-d')
- isJson()
- isNull()
- isNumber()
- isPositive()
- isUppercase()
- isString()
- lengthBetween(min, max)
- matchRegex(regex)
- notEmpty()
- noWhiteSpace()
- oneOf(...$functions)
Pro tips
There is two way to apply muliple validation rules for a single key :
- Use an array of validation functions -> this way you can only use a single error message
- Call addRule multiple times with the same key -> this way you can be more precise with your error messages
All function are curried so you can built-in rules without any argument rather than '\Jarvis\rules\isNumber'.
Todo
- Accept objects
- Add more default rules
All versions of jarvis with dependencies
PHP Build Version
Package Version
The package kilbiller/jarvis contains the following files
Loading the files please wait ....