Respect Validation
The Most awesome validation engine Ever created for PHP
Translating:
The most impressive validation engine ever created for PHP
I really agree. The guys thought of everything when they built this library. This library has validation for numerous types of data: Cpf, cnh, cnpj, numeric, vowels, maximum, minimum, non-empty, etc.
If I’m not mistaken, they have a great contribution from Brazilian programmers.
Here’s how to install (you need Composer):
composer require respect/validation
Link to repository on Github
Here you have several examples of how to use.
Let me show you an example from the documentation itself:
use Respect\Validation\Validator as v;
$user = new stdClass;
$user->name = 'Alexandre';
$user->birthdate = '1987-07-01';
$userValidator = v::attribute('name', v::stringType()->length(1,32))
->attribute('birthdate', v::date()->age(18));
$userValidator->validate($user); // bool(true)
Oops, thank you very much, I’ll give it a try
– Thiago