yesccx / think-validate
use think validate engine for hyperf.
Installs: 43
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 26
pkg:composer/yesccx/think-validate
Requires
- php: >=7.2
- hyperf/command: ~1.1.0
- hyperf/config: ~1.1.0
README
精简 think-validate2.0,去除了topthink/think-container依赖,并做了简单的适配Hyperf
暂不支持协程,只能通过new或者make验证器类
开始使用
1、安装依赖
composer require yesccx/think-validate:2.0.3
2、初始化配置
php bin/hyperf.php think-validate:publish --config
3、相关配置
app/config/autoload/think-validate.php
return [
// 验证器异常类,如果为空则表示不抛出异常(这时需要获取错误信息进行处理)
'validate_exception' => AppException::class,
];
4、使用
class UserValidate extends Yesccx\ThinkValidate\Validate { ... } $uv = new UserValidate 或 $uv = UserValidate::make(); $uv->xxxx
更多用法可以参考6.0完全开发手册的验证章节