ft / attributes
Catalog of PHP attributes like json, logging and property validation
2.2.2
2023-02-14 02:48 UTC
Requires
- ft/reflection: ^2.2
- monolog/monolog: ^3.2
Requires (Dev)
- phpunit/phpunit: ^9.5
README
A catalog of php attributes for flexible and maintainable modeling.
Attributes for logging, json, property validation and more.
Quick example of property validation:
final class MyClass { use PropertyValidator; #[Email] private string $email; #[Min(value: 12)] private int $age; #[Size(min: 1, max: 3)] private array $phone_numbers; }
Quick example of json:
class MyClass { private int $id = 1; #[JsonIgnore] private string $ssn = "xxx-xx-xxxx"; } Json::encode(new MyClass); // { "id" : 1 }
For complete documentation and attribute usages see the documentation wiki