taknone/attributes
最新稳定版本:v1.1.0
Composer 安装命令:
composer require taknone/attributes
包简介
Attribute-based validation for PHP 8.3+
README 文档
README
Attribute-based validation for PHP 8.3+ : validate method parameters, return values and property access using compact, reusable attributes
Validator — Declarative validation using PHP 8+ attributes
A lightweight, framework-agnostic library that lets you declare validation rules as PHP attributes. Validate method parameters, method return values, and property get/set using compact, reusable attribute classes (for example #[Range], #[Pattern], #[Vector]). Built-in caching of reflection metadata keeps runtime overhead low
📦 Installation
Install via Composer :
composer require taknone/attributes
Then enable Composer autoload in your project :
require_once __DIR__.'/vendor/autoload.php';
🚀 Quickstart
The repository includes an examples directory with runnable examples and small helper scripts
Contributing
PRs welcome ! Follow a few rules :
- Run and add example for new validators
- Keep attribute constructor arguments constant expressions ( required by PHP attributes )
- Document behavior for corner cases ( nullability, casting, unique semantics )
License
MIT — see LICENSE
Support / Contact
If you need help integrating Attributes into your project, open an issue or reach out via the repository's issue tracker
统计信息
- 总下载量: 448
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-09