Skip to content

Latest commit

 

History

History
88 lines (60 loc) · 1.77 KB

File metadata and controls

88 lines (60 loc) · 1.77 KB

Installation & Setup

Requirements

  • PHP 8.3 or higher
  • Composer for dependency management

Note: The library ships with declare(strict_types=1);. Validation failures throw ValidationException; use coerce() if you need form-friendly conversions.

Installation

Install the Lemmon Validator via Composer:

composer require lemmon/validator

Autoloading

The 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();

Verification

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";
}

Development Installation

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

Running Tests

# Run all tests
composer test

# Run tests with coverage
composer test -- --coverage

Code Quality Tools

# Check code style
composer lint

# Fix code style issues
composer fix

# Run static analysis
composer analyse

Next Steps