Validators are used to validate data and provide useful error messages explaining why a piece of data failed.

Validators must implement Centum\Interfaces\Validator\ValidatorInterface.

Validators only require one public method:

  • validate(mixed $value): list<non-empty-string>

The validate() method must return an array of string messages explaining why the data is not valid. If a piece of data is valid, then validate() would return an empty array.

Table of contents