psx/validate

Validate data through a filter system

v2.0.1 2024-05-10 18:02 UTC

This package is auto-updated.

Last update: 2024-11-10 19:00:20 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());
}