kanfa / validator
Data validator
dev-master
2018-05-08 21:51 UTC
Requires
- hassankhan/config: ^1.0
Requires (Dev)
- phpunit/phpunit: ^7.1
This package is not auto-updated.
Last update: 2024-10-27 06:02:41 UTC
README
Data validation based on rules
Basic use
$validator = new class extends \Validator\Core\AbstractValidator {}; $validator->defineRules([ 'username' => 'max(50):min(4)', 'other' => 'equals(:username)' ]); $data = ['username' => 'Kanfa', 'other' => 'Other']; if ($validator->validate($data)) { // Action } else { $errors = $validator->getErrors(); // Error action }