einlinuus / php-validator
Minimal library to validate and transform user input
1.0.0
2024-02-24 19:22 UTC
Requires
None
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-22 13:34:13 UTC
README
A small, chainable PHP library for validating and transforming input values.
Installation
Install the package with Composer:
composer require einlinuus/php-validator
Quick start
<?php use EinLinuus\PhpValidator\EinLinuus\PhpValidator\Validator; use EinLinuus\PhpValidator\EinLinuus\PhpValidator\ValidatorException; require_once __DIR__ . '/vendor/autoload.php'; $validator = new Validator('hello world'); try { $validator ->isString('Input must be a string') ->isLowercase('Input must be lowercase') ->min(3, 'Input must be at least 3 characters long') ->max(12, 'Input must be at most 12 characters long'); $validated = $validator->get(); } catch (ValidatorException $exception) { echo 'Invalid: ' . $exception->getMessage(); }
Documentation
- Overview
- Getting started
- Guides
- Reference
- Project documentation
License
PHP Validator is licensed under the GNU General Public License v3.0.