wdmg / yii2-validators
为Yii 2.0提供的自定义验证器
1.1.0
2023-07-07 06:53 UTC
Requires
- yiisoft/yii2: ^2.0.40
README
Yii2 Validators
为Yii2提供的自定义验证器
需求
- PHP 5.6或更高版本
- Yii2 v.2.0.40及最新版本
安装
要在控制台中安装验证器,请运行以下命令
$ composer require "wdmg/yii2-validators"
使用方法
StopListValidator示例用法,用于模型规则
<?php
use wdmg\validators\StopListValidator;
...
public function rules() {
return [
[['attribute'], StopListValidator::class, 'stoplist' => ['admin', 'root', 'superuser', ...], 'message' => 'You can not use this value `{value}` for field `{attribute}`'],
...
];
}
?>
状态和版本[开发中]
- v.1.1.0 - 更新版权信息
- v.1.0.7 - StopListValidator更名为ReservedValidator
- v.1.0.6 - 更新README.md和依赖项