Skip to content

Commit 092dc6e

Browse files
committed
update README.md
1 parent 2394fe2 commit 092dc6e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
一个简洁小巧且功能完善的php验证库。仅有几个文件,无依赖。
44

5-
> 规则设置参考自 yii 的。
5+
> 规则设置参考自 yii 的。部分规则参考自 laravel
66
77
## 项目地址
88

@@ -482,6 +482,13 @@ public function get(string $key, $default = null)
482482
`alphaNum` | 验证是否仅包含字母、数字 | `['field', 'alphaNum']`
483483
`alphaDash` | 验证是否仅包含字母、数字、破折号( - )以及下划线( _ ) | `['field', 'alphaDash']`
484484
`isArray` | 验证是否是json字符串 | `['goods', 'isArray']`
485+
`required` | 要求此字段/属性是必须的 | `['tagId, userId', 'required' ]`
486+
`requiredIf` | 指定的其它字段( anotherField )值等于任何一个 value 时,此字段为 **必填** | `['city', 'requiredIf', 'myCity', ['chengdu'] ]`
487+
`requiredUnless` | 指定的其它字段( anotherField )值等于任何一个 value 时,此字段为 **不必填** | `['city', 'requiredUnless', 'myCity', ['chengdu'] ]`
488+
`requiredWith` | 指定的字段中的 _任意一个_ 有值且不为空,则此字段为 **必填** | `['city', 'requiredWith', ['myCity'] ]`
489+
`requiredWithAll` | 如果指定的 _所有字段_ 都有值,则此字段为 **必填** | `['city', 'requiredWithAll', ['myCity', 'myCity1'] ]`
490+
`requiredWithout` | 如果缺少 _任意一个_ 指定的字段值,则此字段为 **必填** | `['city', 'requiredWithout', ['myCity', 'myCity1'] ]`
491+
`requiredWithoutAll` | 如果所有指定的字段 都没有 值,则此字段为 **必填** | `['city', 'requiredWithoutAll', ['myCity', 'myCity1'] ]`
485492
`json` | 验证是否是数组 | `['goods', 'json']`
486493
`url` | 验证是否是 url | `['myUrl', 'url']`
487494
`email` | 验证是否是 email | `['userEmail', 'email']`
@@ -490,8 +497,7 @@ public function get(string $key, $default = null)
490497
`ip` | 验证是否是 IP | `['ipAddr', 'ip']`
491498
`ipv4` | 验证是否是 IPv4 | `['ipAddr', 'ipv4']`
492499
`ipv6` | 验证是否是 IPv6 | `['ipAddr', 'ipv6']`
493-
`required` | 要求此字段/属性是必须的 | `['tagId, userId', 'required' ]`
494-
`size` | 验证大小范围, 可以支持验证 `int`, `string`, `array` 数据类型 | `['tagId', 'size', 'min'=>4, 'max'=>567]` `['name', 'size', 'max' => 16]`
500+
`size` | 验证大小范围, 可以支持验证 `int`, `string`, `array` 数据类型 | `['tagId', 'size', 'min'=>4, 'max'=>567]`
495501
`range` | `size` 验证的别名 | 跟 `size` 一样
496502
`length` | 长度验证( 跟 `size`差不多, 但只能验证 `string`, `array` 的长度 | ....
497503
`min` | 最小边界值验证 | `['title', 'min', 40]`
@@ -505,6 +511,7 @@ public function get(string $key, $default = null)
505511
* 如果是 "1"、"true"、"on" 和 "yes",则返回 TRUE
506512
* 如果是 "0"、"false"、"off"、"no" 和 "",则返回 FALSE
507513
- 验证大小范围 `int` 是比较大小。 `string``array` 是检查长度
514+
- `required*` 系列规则参考自 laravel
508515

509516
## 其他
510517

0 commit comments

Comments
 (0)