yonna / validator
validator验证器
1.0
2020-05-15 09:47 UTC
Requires
- php: ~7.3
- yonna/foundation: ~1.0
This package is auto-updated.
Last update: 2024-11-15 19:30:23 UTC
README
Yonna validator库
validator 协助你处理数据校验
如何安装
可以通过composer安装:composer require yonna/validator
可以通过git下载:git clone https://github.com/yonna-framework/validator.git
Yonna demo:GOTO yonna
array
<?php use Yonna\Validator\ArrayValidator; ArrayValidator::required($this->input(), ['uid', 'login_name'], function ($error) { Exception::params($error); }); ArrayValidator::integer($this->input(), ['qty', 'views'], 0, 10000, function ($error) { Exception::params($error); }); ArrayValidator::multiple( $this->input(), [ 'uid' => [ 'required' => true, ], 'quantity' => [ 'type' => 'int', 'min' => 1, 'max' => 10, ], 'some_list' => [ 'type' => 'array', ], ], function ($error) { Exception::params($error); } ); ?>