programmatordev / yet-another-php-validator
PHP validator with expressive error messages
v1.3.0
2024-08-14 16:36 UTC
Requires
- php: >=8.1
- egulias/email-validator: ^4.0
- symfony/intl: ^6.4
- symfony/polyfill-ctype: ^1.27
- symfony/polyfill-intl-grapheme: ^1.29
- symfony/polyfill-intl-icu: ^1.29
Requires (Dev)
- phpunit/phpunit: ^10.0
- symfony/var-dumper: ^6.4
README
PHP validator with expressive error messages.
Requirements
- PHP 8.1 or higher.
Installation
Install the library via Composer:
composer require programmatordev/yet-another-php-validator
Basic Usage
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.
Documentation
Contributing
Any form of contribution to improve this library (including requests) will be welcome and appreciated. Make sure to open a pull request or issue.
Acknowledgments
This library is inspired by respect/validation and symfony/validator.
License
This project is licensed under the MIT license. Please see the LICENSE file distributed with this source code for further information regarding copyright and licensing.