harry-ykh/php-validate
最新稳定版本:v1.9
Composer 安装命令:
composer require harry-ykh/php-validate
包简介
A standalone, framework-agnostic PHP validation library refactored from ThinkPHP's validator. 这是一个基于 ThinkPHP 框架验证器改造的独立 PHP 验证库,可用于任何 PHP 项目。
README 文档
README
A standalone, framework-agnostic PHP validation library refactored from ThinkPHP's validator. 这是一个基于 ThinkPHP 框架验证器改造的独立 PHP 验证库,可用于任何 PHP 项目。
Features / 特性
- Framework Agnostic / 框架无关: Can be used in any PHP project (Laravel, Symfony, Slim, plain PHP, etc.).
- Standalone / 独立: No dependencies on ThinkPHP core, ORM, or other components.
- Easy to Use / 简单易用: Familiar API for ThinkPHP users.
Requirements / 环境要求
- PHP >= 8.1
Installation / 安装
composer require harry-ykh/php-validate
Usage / 使用
use harry\Validate; $data = [ 'name' => 'harry', 'email' => 'test@example.com' ]; $validate = new Validate(); $validate->rule([ 'name' => 'require|max:25', 'email' => 'email' ]); if (!$validate->check($data)) { var_dump($validate->getError()); }
Removed Features / 移除的特性
Compared to the original ThinkPHP validator, the following dependencies have been removed: 相较于原版 ThinkPHP 验证器,移除了以下依赖:
- Database Unique Validation / 数据库唯一性验证: Removed dependency on
think-orm(uniquerule). - Multi-language Support / 多语言支持: Removed dependency on
think-lang(Simplified error messages). - Token Validation / 表单令牌: Removed dependency on
think-session/request(tokenrule).
License
Apache-2.0
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2024-12-24