cakephp/validation
最新稳定版本:5.3.0-RC2
Composer 安装命令:
composer require cakephp/validation
包简介
CakePHP Validation library
README 文档
README
CakePHP Validation Library
The validation library in CakePHP provides features to build validators that can validate arbitrary arrays of data with ease.
Usage
Validator objects define the rules that apply to a set of fields. Validator objects contain a mapping between fields and validation sets. Creating a validator is simple:
use Cake\Validation\Validator; $validator = new Validator(); $validator ->requirePresence('email') ->add('email', 'validFormat', [ 'rule' => 'email', 'message' => 'E-mail must be valid' ]) ->requirePresence('name') ->notEmptyString('name', 'We need your name.') ->requirePresence('comment') ->notEmptyString('comment', 'You need to give a comment.'); $errors = $validator->validate($_POST); if (!empty($errors)) { // display errors. }
Documentation
Please make sure you check the official documentation
统计信息
- 总下载量: 483.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 44
- 点击次数: 1
- 依赖项目数: 14
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-08-26