Download the PHP package mix/validate without Composer
On this page you can find all versions of the php package mix/validate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor mix
Package validate
Short Description Validate library, reference Yii2
License Apache-2.0
Homepage https://openmix.org/
Package validate
Short Description Validate library, reference Yii2
License Apache-2.0
Homepage https://openmix.org/
Please rate this library. Is it a good library?
Informations about the package validate
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 validate with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.0.0
ext-mbstring Version *
psr/http-message Version ^1.0
mix/bean Version ~2.2.0
ext-mbstring Version *
psr/http-message Version ^1.0
mix/bean Version ~2.2.0
The package mix/validate contains the following files
Loading the files please wait ....