Download the PHP package hyperf-plus/validate without Composer

On this page you can find all versions of the php package hyperf-plus/validate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package validate

HPlus Validate 4.0

PHP Version Hyperf Version CI

基于 hyperf/validation 的请求验证组件,支持注解式验证和 FormRequest 验证器。 内置中文错误提示兜底、本地无语言包也能返回中文;默认安全过滤多余字段,可选安全模式拒绝未定义字段。

✨ 4.0 新特性

⚠️ 破坏性变更: 4.0 版本移除了 ThinkPHP 风格的 Validate 基类,仅支持 Hyperf 原生 FormRequest。

📦 安装

依赖

🚀 快速开始

方式一:内联规则(推荐)

方式二:FormRequest 验证器

📋 注解参数

🎯 使用场景

验证 Query 参数(GET 请求)

同时验证 Query 和 Body

安全模式

拒绝请求中包含未定义的字段:

过滤模式

自动过滤多余字段,只保留规则中定义的字段:

📐 支持的验证规则

完全兼容 Laravel/Hyperf Validation 所有规则:

分类 规则
基础 required, nullable, string, integer, numeric, boolean, array
字符串 email, url, ip, uuid, alpha, alpha_num, regex:pattern
数值 min:value, max:value, between:min,max, size:value, gt:field, gte:field
日期 date, date_format:format, before:date, after:date
数组 in:foo,bar, not_in:foo,bar, distinct, array
数据库 unique:table,column, exists:table,column
文件 file, image, mimes:jpg,png, max:size
关系 confirmed, same:field, different:field, required_if:field,value

更多规则:https://laravel.com/docs/validation#available-validation-rules

🛠️ 高级用法

自定义验证规则

嵌套数组验证

条件验证

❌ 错误处理

验证失败抛出 ValidateException(HTTP 422):

🧪 测试覆盖

运行测试:

📊 与 3.x 版本对比

特性 3.x 4.0
ThinkPHP Validate ✅ ❌ 移除
Hyperf FormRequest ✅ ✅
内联规则 ✅ ✅
dateType 参数 ✅ ❌ 改为 mode
validate + scene 分离注解 统一到 RequestValidation
缓存统计 ✅ ❌ 移除(无意义开销)

迁移指南

📄 License

MIT


All versions of validate with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
hyperf/di Version ^3.1.0
hyperf/http-message Version ^3.1.0
hyperf/utils Version ^3.1.0
hyperf/validation Version ^3.1.0
hyperf/translation Version ^3.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperf-plus/validate contains the following files

Loading the files please wait ...