Download the PHP package runner/validator without Composer
On this page you can find all versions of the php package runner/validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package validator
Validator
Lightweight Validation Like Laravel
使用
内置验证规则
accept:字段的取值范围必须是:yes、on、'1'、1、true 中的一个numeric:字段的值必须是数字(包括整形和浮点数)integer:字段的值必须是整形float:字段的值必须是浮点型size:字段的值必须为指定长度url:字段的值必须是合法的 url 类型boolean:字段的值必须是布尔类型confirm:字段的值必须与指定值相等date:字段的值必须是一个合法的日期email:字段的值必须是一个合法的 emailrequired:必须包含该字段requiredWith:如果指定的字段中的任意一个有值且不为空,则此字段为必填requiredWithout:如果缺少任意一个指定的字段,则此字段为必填requiredIf:如果指定的其它字段(anotherfield)等于任何一个 value 时,此字段为必填array:字段的值必须是数组类型string:字段的值必须是字符串类型min:字段的值必须大于等于指定值max:字段的值必须小于等于指定值range:字段的值长度必须指定范围内,包含 min 和 max。regex:字段的值必须匹配指定的正则表达式in:字段的值必须在指定的数组内ip:字段的值必须是一个合法的 ipdateFormat:字段的值必须是一个合法的 date format 格式。参考:http://php.net/manual/en/datetime.createfromformat.phpdateBefore:字段的值必须小于给定时间。给定时间值非时间戳格式,而是 date/time 字符串,如:10 September 2000dateAfter:字段的值必须大于给定时间。时间值格式同上。json:字段的值必须是一个合法的 JSON 格式
Note
关于空字符串
如果传入一个数组:
同时规则设置为:
此时校验结果会是通过的. 也就是说 validator 不会把 '' 当作 null 处理.
参考
All versions of validator with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.6
ext-mbstring Version *
ext-mbstring Version *
The package runner/validator contains the following files
Loading the files please wait ...

