- PHP 8.1 or higher.
Install the library via Composer:
composer require programmatordev/yet-another-php-validator
Simple usage looks like:
use ProgrammatorDev\Validator\Validator;
// do this:
$validator = Validator::type('int')->greaterThanOrEqual(18);
// and validate with these:
$validator->validate(16); // returns bool: false
$validator->assert(16, 'age'); // throws exception: The age value should be greater than or equal to 18.