mohammedalkutrani/validator
Composer 安装命令:
composer require mohammedalkutrani/validator
包简介
validate form-data
README 文档
README
It's a simple packge for validation the data before touch your database.
Core Features
- PSR-4 for autoloading.
- PSR-2 for coding style.
- Strategy Pattern for changing the rules in the runtime.
- Facade Pattern for make it esey to use.
- Implements your own rule.
- Test 100%.
Installation
composer require mohammedalkutrani/validator
Simple Usage
use Validator\Facade\Validation; use Validator\Rules; $v = Validation::make( [ // the given data. 'name' => 'mohammedalkutrani@gmail.com', 'age' => 25 ], [ // the rules for the data. 'name' => [Rules::NUMBER, Rules::MIN.'|4'], 'age' => [Rules::EMAIL] ] ); // check if it passed if(!$v->isPassed()) // it will return boolean { print_r($v->getMessages()); // getting the messages. }
The result
Array ( [name] => Array ( [0] => the name should be a number [1] => the name should shorter then 4 ) [age] => Array ( [0] => the age should be an email ) )
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-27