newclass / judex
The PHP validator.
v1.3.0
2017-01-10 12:17 UTC
Requires
- php: >=5.5.0
This package is auto-updated.
Last update: 2025-02-16 23:32:24 UTC
README
What is Judex?
Judex is a PHP validator.
Installation
The best way to install is to use the composer by command:
composer require newclass/judex
composer install
Use example
use Judex\Validator\EmailValidator;
use Judex\Validator\NotEmptyValidator;
use Judex\ValidatorManager;
$validator=new ValidatorManager();
$validator->addValidator(new EmailValidator());
$validator->addValidator(new NotEmptyValidator());
$result=$validator->validate('test@newclass.pl');
$valid=$result->isValid(); //return true
$result=$validator->validate('test.newclass.pl');
$valid=$result->isValid(); //return false
$errors=$result->getErrors(); //return ['Value is not valid format email.']
$result=$validator->validate('');
$valid=$result->isValid(); //return false
$errors=$result->getErrors(); //return ['Value can\'t be empty.']