hyperf-plus/validate

hyperf-plus validate 支持request 和方法场景验证,兼容tp5写法 支持控制器注解验证、方法注解验证

v3.1.1 2024-08-29 09:41 UTC

This package is auto-updated.

Last update: 2024-10-29 10:03:37 UTC


README

兼容tp验证器规则,支持多场景,swagger自动提取验证规则。

安装

composer require hyperf-plus/validate

验证失败抛出 ValidateException

用法1

@RequestValidation(rules={
    "username|用户名":"require|max:25",
    "password|密码":"require"
})

用法2 验证类、验证场景

@RequestValidation(validate=User::class,scene="login")