Download the PHP package mix/validator without Composer
On this page you can find all versions of the php package mix/validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download mix/validator
More information about mix/validator
Files in mix/validator
Download mix/validator
More information about mix/validator
Files in mix/validator
Vendor mix
Package validator
Short Description Validator based on PSR-7 standard
License Apache-2.0
Homepage https://openmix.org/mix-php
Package validator
Short Description Validator based on PSR-7 standard
License Apache-2.0
Homepage https://openmix.org/mix-php
Please rate this library. Is it a good library?
Informations about the package validator
OpenMix 出品:https://openmix.org
Mix Validator
Validator based on PSR-7 standard
基于 PSR-7 标准的验证器
Installation
创建表单
继承 Mix\Validator\Validator
并定义:
public $name
字段名rules()
验证规则scenarios()
验证场景messages()
错误消息
在控制器中验证
$form->error() : string
获取单条错误信息$form->errors() : array
获取全部错误信息
验证规则
全部的验证类型与对应的验证选项如下
call 验证类型
该类型为用户自定义验证规则,callback 内指定一个用户自定义的方法来验证
file / image 验证类型
该类型用来验证文件,包含的两个验证选项如下:
- mimes:输入你想要限制的文件mime类型,MIME参考手册
- maxSize:允许的文件最大尺寸,单位 KB
验证成功后模型类会增加一个同名属性,该属性为 Psr\Http\Message\UploadedFileInterface 类的实例化对象,可直接调用 $this->[attributeName]->moveTo($targetPath) 移动到你需要存放的位置
静态调用
License
Apache License Version 2.0, http://www.apache.org/licenses/
All versions of validator with dependencies
PHP Build Version
Package Version
The package mix/validator contains the following files
Loading the files please wait ....