yesccx/think-validate

use think validate engine for hyperf.

v2.0.4 2020-04-03 10:18 UTC

This package is auto-updated.

Last update: 2024-04-29 04:20:34 UTC


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完全开发手册的验证章节