Skip to content

Joylei/php-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-Validation

Another fluent validation library for php

Usage

$validator = new Validator();
$validator->ruleFor('field1',function(){
    $this->isRequired('required');
    $this->isNumber('is number');
})->end()->ruleFor('field2', function(){
    $this->hasRange(5, 10, 'range(5,10)');
});

$result = $validator->validate([
    'field1' => 'aaa',
    'field2' => '20'
]);

echo $result->hasError();
echo $result->getError();

For more information, please see tests in the source code.

License

MIT

About

Another fluent validation library for php

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages