|
3 | 3 | [](LICENSE) |
4 | 4 | [](https://packagist.org/packages/inhere/php-validate) |
5 | 5 | [](https://packagist.org/packages/inhere/php-validate) |
| 6 | +[](https://github.com/inhere/php-validate) |
6 | 7 |
|
7 | 8 | 一个简洁小巧且功能完善的php验证、过滤库。仅有几个文件,无依赖。 |
8 | 9 |
|
|
13 | 14 | - 支持自定义每个验证的错误消息,字段翻译,消息翻译,支持默认值 |
14 | 15 | - 支持基本的数组检查,数组的子级值检查 |
15 | 16 | - 方便的获取错误信息,验证后的安全数据获取 |
16 | | -- 已经内置了30多个常用的验证器[内置验证器](#built-in-validators) |
| 17 | +- 已经内置了40多个常用的验证器[内置验证器](#built-in-validators) |
17 | 18 | - 规则设置参考自 yii 的。部分规则参考自 laravel |
18 | 19 | - `RuleValidation` 规则配置类似于Yii: 每条规则中,允许多个字段,但只能有一个验证器。 |
19 | 20 | - e.g `['tagId,userId,name,email,freeTime', 'required', ...]`(下面的示例都是这种) |
|
24 | 25 |
|
25 | 26 | ## 项目地址 |
26 | 27 |
|
27 | | -- **git@osc** https://git.oschina.net/inhere/php-validate.git |
| 28 | +- **git@osc** https://gitee.com/inhere/php-validate.git |
28 | 29 | - **github** https://github.com/inhere/php-validate.git |
29 | 30 |
|
30 | 31 | **注意:** |
@@ -596,8 +597,10 @@ public function get(string $key, $default = null) |
596 | 597 | `length` | 长度验证( 跟 `size`差不多, 但只能验证 `string`, `array` 的长度 | `['username', 'length', 'min' => 5, 'max' => 20]` |
597 | 598 | `in/enum` | 枚举验证 | `['status', 'in', [1,2,3]` |
598 | 599 | `notIn` | 枚举验证 | `['status', 'notIn', [4,5,6]]` |
599 | | -`mustBe` | 必须是等于给定值 | `['status', 'mustBe', 0]` |
600 | | -`compare/same/equal` | 字段值比较 | `['passwd', 'compare', 'repasswd']` |
| 600 | +`mustBe` | 必须是等于给定值 | `['status', 'mustBe', 1]` |
| 601 | +`mustBe` | 不能等于给定值 | `['status', 'notBe', 0]` |
| 602 | +`compare/same/equal` | 字段值相同比较 | `['passwd', 'compare', 'repasswd']` |
| 603 | +`notEqual` | 字段值不能相同比较 | `['passwd', 'notEqual', 'repasswd']` |
601 | 604 | `required` | 要求此字段/属性是必须的 | `['tagId, userId', 'required' ]` |
602 | 605 | `requiredIf` | 指定的其它字段( anotherField )值等于任何一个 value 时,此字段为 **必填** | `['city', 'requiredIf', 'myCity', ['chengdu'] ]` |
603 | 606 | `requiredUnless` | 指定的其它字段( anotherField )值等于任何一个 value 时,此字段为 **不必填** | `['city', 'requiredUnless', 'myCity', ['chengdu'] ]` |
|
0 commit comments