- PHP 8.3 or higher
- Composer for dependency management
Note: The library ships with
declare(strict_types=1);. Validation failures throwValidationException; usecoerce()if you need form-friendly conversions.
Install the Lemmon Validator via Composer:
composer require lemmon/validatorThe package follows PSR-4 autoloading standards. If you're using Composer's autoloader, you can start using the validator immediately:
<?php
require_once 'vendor/autoload.php';
use Lemmon\Validator\Validator;
// Ready to use!
$validator = Validator::isString();Verify your installation by running a simple validation:
<?php
require_once 'vendor/autoload.php';
use Lemmon\Validator\Validator;
try {
$result = Validator::isString()->email()->validate('test@example.com');
echo "✅ Installation successful! Email validation works.\n";
echo "Result: " . $result . "\n";
} catch (Exception $e) {
echo "❌ Installation issue: " . $e->getMessage() . "\n";
}If you want to contribute to the project or run tests, clone the repository:
git clone https://github.com/lemmon/validator-php.git
cd validator-php
composer install# Run all tests
composer test
# Run tests with coverage
composer test -- --coverage# Check code style
composer lint
# Fix code style issues
composer fix
# Run static analysis
composer analyse- Basic Usage -- Learn the fundamentals
- Core Concepts -- Understand the architecture
- String Validation Guide -- Start with string validation