A lightweight and extensible validation engine for ImpulsePHP. The validator provides common validation rules and a unified API for server-side form validation.
Use Composer to add the package to your project:
composer require impulsephp/validator
If you are working from the source repository, run composer install
to generate the autoloader.
use Impulse\Validator\Validator;
$validator = new Validator();
$errors = $validator->validate('username', 'Bob', 'required|min_length:3');
if ($errors) {
// Handle validation errors
}
More extensive documentation is available in the docs directory:
Unit tests are written with PHPUnit. From the project root run:
composer install
vendor/bin/phpunit
A simple test configuration is included in phpunit.xml
.