Download the PHP package hehex/hehep-hvalidation without Composer
On this page you can find all versions of the php package hehex/hehep-hvalidation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download hehex/hehep-hvalidation
More information about hehex/hehep-hvalidation
Files in hehex/hehep-hvalidation
Download hehex/hehep-hvalidation
More information about hehex/hehep-hvalidation
Files in hehex/hehep-hvalidation
Vendor hehex
Package hehep-hvalidation
Short Description hehep-hvalidation 是一个PHP验证器基础组件
License Apache-2.0
Package hehep-hvalidation
Short Description hehep-hvalidation 是一个PHP验证器基础组件
License Apache-2.0
Please rate this library. Is it a good library?
Informations about the package hehep-hvalidation
hehep-hvalidation
介绍
- hehep-hvalidation 是一个PHP 验证器工具组件
- 支持多个验证器
- 支持验证多个属性
- 支持验证多维数组
- 直接使用验证器验证
- 支持与或 or,and,&,| 运算
- 支持单独设置验证规则错误消息
- 支持验证规则使用场景
- 支持设置验证规则的前置条件
- 支持添加自定义验证器
- 支持验证器直接为方法或函数
- 支持自定义错误码
安装
-
gitee下载:
-
github下载:
- 命令安装:
组件配置
基本示例
-
快速使用
-
多个验证器,支持与或(or,and,&,|)
-
验证多个属性(不建议这么用)
-
验证多维数组
-
设置验证规则错误消息
-
设置验证器错误消息
-
设置验证规则使用场景
-
设置验证规则的前置条件
-
添加自定义验证器
-
验证器直接为方法或函数
-
验证器直接为闭包
-
直接使用验证器验证
-
直接实例化验证类,调用验证类方法
- 注解注册验证规则
扩展验证器
- 操作步骤如下
步骤1。创建自定义验证器集合类
步骤2。创建手机号码验证器类
步骤3。验证器类组件配置
安装验证器
-
指定验证器安装
-
指定验证器类同目录下所有验证器安装
-
指定验证器类同级目录以及其子目录下所有验证器
-
安装指定后缀的验证器(默认前缀validator)
- 指定目录安装(目录下所有验证器都会安装)
注解验证
-
定义被验证类
- 验证示例
默认验证器
验证器 | 说明 | 规则示例 |
---|---|---|
required |
必填字段 | ['fieldname', ['required'] ] |
empty |
不为空字段,常配合!使用 | ['fieldname', ['empty'] ] ,['fieldname', ['!empty'] ] |
float |
数值必须为浮点数,即整型,或带小数点的数值 | ['fieldname', ['float','decimalPoint'=>'最少保留的小数点位数,如2','symbol'=>'正负符号,如-,+'] ] |
int |
数值必须为整型 | ['fieldname', ['int','symbol'=>'正负符号,如-,+'] ] |
boolean |
数值必须为布尔值,True or False | ['fieldname', ['boolean'] ] |
tel |
11 位手机号 | ['fieldname', ['tel'] ] |
date |
验证日期格式 | ['fieldname', ['date',["format":'Y-m-d']] ] |
rangedate |
验证日期范围 | ['fieldname', ['rangedate',"min"=>'最小日期,如2019-10-10','max'=>'最大日期,如2010-10-11'] ] |
email |
验证邮箱格式 | ['fieldname', ['email'] ] |
file |
验证表单file格式 | ['fieldname', ['file','max_size'=>0.5,'exts'=>['jpg','gif','png'],'mimes'=>['image/gif']] ] |
ip |
验证ip格式,支持mode 格式 ip4,ip6 | ['fieldname', ['ip',"mode"=>"ip4"] |
ip4 |
验证ip4格式 | ['fieldname', ['ip4']] |
ip6 |
验证ip6格式 | ['fieldname', ['ip6']] |
url |
验证url 地址格式,支持设置defaultScheme | ['fieldname', ['url',"defaultScheme"=>"https"]] |
range |
验证数值范围大小 | ['fieldname', ['range',"min"=>10,'max'=>20] ] |
compare |
比较指定数值大小,支持操作符,'gt','egt','lt','elt','eq','>','>=','<','<=','=' | ['fieldname', ['compare',"number"=>10,"operator"=>"gt"] ] |
eq |
验证数值相等,compare 操作符 eq 的简写 | ['fieldname', ['eq',"number"=>1]] |
gt |
验证数值大于,compare 操作符 gt 的简写 | ['fieldname', ['gt',"number"=>1]] |
egt |
验证数值大于等于,compare 操作符 egt 的简写 | ['fieldname', ['egt',"number"=>1]] |
lt |
验证数值小于,compare 操作符 lt 的简写 | ['fieldname', ['lt',"number"=>1]] |
elt |
验证数值小于等于,compare 操作符 elt 的简写 | ['fieldname', ['elt',"number"=>1]] |
minlen |
验证字符最小长度 | ['fieldname', ['minlen',"number"=>1]] |
maxlen |
验证字符最大长度 | ['fieldname', ['maxlen',"number"=>1]] |
eqlen |
验证字符固定长度 | ['fieldname', ['eqlen',"number"=>1]] |
rangelen |
验证字符长度范围 | ['fieldname', ['rangelen',"min"=>1,'max'=>3]] |
currency |
验证货币数值,比如0.51,decimalPoint 表示最多几位小数,默认最多2位 | ['fieldname', ['currency',"decimalPoint"=>2]] |
cn |
验证中文格式 | ['fieldname', ['ch']] |
en |
验证英文格式 | ['fieldname', ['en']] |
card |
验证身份证格式 | ['fieldname', ['card']] |
alpha |
验证包含字母字符格式 | ['fieldname', ['alpha']] |
alphaNum |
验证包含字母、数字格式 | ['fieldname', ['alphaNum']] |
alphaDash |
验证字母、数字、破折号( - )以及下划线( _ )格式 | ['fieldname', ['alphaDash']] |
inlist |
输入的值或值集合必须包含在指定的列表 | ['fieldname', ['inlist',['numbers'=>['1','2','3']]]] |
enum |
输入的值必须包含在指定的列表 | ['fieldname', ['enum',['numbers'=>['1','2','3']]]] |
notin |
输入的值必须不包含在指定的列表 | ['fieldname', ['notin']] |
vlist |
给列表里的每个元素指定验证器 | ['fieldname', ['vlist',[ ['int'],['minlen'] ]]] |
ids |
验证id值是否为整型 | ['fieldname', ['ids']] |
eqstrfield |
验证字段与指定字段值是否相等 | ['fieldname', ['eqstrfield',"field"=>"confirmpassword"]]]] |
eqintfield |
验证字段与指定字段数值是否相等 | ['fieldname', ['eqintfield',"field"=>"age"]]] |
gtintfield |
验证字段与指定字段数值是否大于 | ['fieldname', ['gtintfield',"field"=>"age"]] |
egtintfield |
验证字段与指定字段数值是否大于等于 | ['fieldname', ['egtintfield',"field"=>"age"]] |
ltintfield |
验证字段与指定字段数值是否小于 | ['fieldname', ['ltintfield',"field"=>"age"]] |
eltintfield |
验证字段与指定字段数值是否小于等于 | ['fieldname', ['eltintfield',"field"=>"age"]] |
gtdatefield |
验证日期字段与指定日期字段数值是否大于 | ['enddate', ['gtdatefield',"field"=>"startdate"]] |
egtdatefield |
验证日期字段与指定日期字段数值是否大于等于 | ['enddate', ['egtdatefield',"field"=>"startdate"]]] |
ltdatefield |
验证日期字段与指定日期字段数值是否小于 | ['enddate', ['ltdatefield',"field"=>"startdate"]] |
eltdatefield |
验证日期字段与指定日期字段数值是否小于等于 | ['enddate', ['eltdatefield',"field"=>"startdate"]] |
All versions of hehep-hvalidation with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.1
The package hehex/hehep-hvalidation contains the following files
Loading the files please wait ....