mini\Validator\AttributeValidatorFactory class

Documentation

Builds validators from PHP class attributes

Scans class properties for validation attributes and constructs a Validator instance that validates the entire object structure.

Supports purpose-scoped validation (like Jakarta/Symfony groups):

  • forClass(User::class) returns core validator (attributes without purpose)
  • forClass(User::class, Purpose::Create) returns purpose-specific validator

Methods (5)

Build a validator from a class using reflection

Check if an attribute's purpose matches the requested purpose

Build a validator from a Field attribute

Build a validator for a single property from its attributes

Apply a validation attribute to a validator

Source

src/Validator/AttributeValidatorFactory.php:19-246