zean / validator
PHP validate tools
v1.01
2016-09-10 16:12 UTC
Requires
- php: >=5.5
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2025-01-04 20:57:31 UTC
README
A very simplify php validate tool
Install
composer require zean/validator
Usage
<?php use Zean\Validator\Validator; $rules = [ 'name' => 'required|length:2,5', 'date' => function($value){ return strtotime($value) > time(); } ]; $data = [ 'name' => 'andy', 'date'=>'2015-07-29' ]; $result = Validator::validate($data, $rules);
array(2) { 'name' => bool(true) 'date' => bool(false) }