psx/validate

Validate data through a filter system

v1.0.1 2017-05-08 21:29 UTC

README

About

Validation library which validates arbitrary data using a flexible filter system.

Usage

<?php

use PSX\Validate\Filter;
use PSX\Validate\Validate;

$validate = new Validate();
$result   = $validate->validate($data, Validate::TYPE_STRING, [new Filter\Alnum(), new Filter\Length(3, 255)]);

if ($result->isSuccessful()) {
    echo 'Valid!';
} else {
    echo implode(', ', $result->getErrors());
}