newclass/judex

The PHP validator.

v1.3.0 2017-01-10 12:17 UTC

This package is auto-updated.

Last update: 2024-09-16 22:43:48 UTC


README

license PHP 5.5+

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.']