Skip to content

Attribute-based validation for PHP 8.3+ : validate method parameters, return values and property access using compact, reusable attributes

License

Notifications You must be signed in to change notification settings

TakNone/Attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Attributes

PHP Version License: MIT

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 :

  1. Run and add example for new validators
  2. Keep attribute constructor arguments constant expressions ( required by PHP attributes )
  3. 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

About

Attribute-based validation for PHP 8.3+ : validate method parameters, return values and property access using compact, reusable attributes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages