revenuewire / validator
RW Helpers
Installs: 1 336
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 0
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: ^6.2
README
Quick Start
Install
composer require revenuewire/validator
Usages
Simple Example
//example of testing my age $validator = new \RW\Validator(); $result = $validator->validateAge(20, "myAge", ["min" => 18, "max" => 99]); var_dump($result); //true //same validator, but using birthday $validator = new \RW\Validator(); $result = $validator->validateAge("1987-01-08", "myAge", ["min" => 18, "max" => 99]); var_dump($result); //true $validator = new \RW\Validator(); $result = $validator->validateAge(16, "myAge", ["min" => 18, "max" => 99]); var_dump($result); //false /** * [ * "key" => "myAge", * "error" => "myAge must be greater than 18.", * "contexts" => [ * "min" => 18, "max" => 99 * ] * ] */ var_dump($validator->getValidateResult());