skoop / Validator

Particle\Validator is a validation library with an extremely clean API which makes validation fun!

Home Page:http://validator.particle-php.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

Travis-CI Packagist Packagist downloads Scrutinizer Scrutinizer

Particle\Validator is a very small validation library, with the easiest and most usable API we could possibly create.

Small usage example

$v = new Validator;

$v->required('first_name')->length(5);

$result = $v->validate(['first_name' => 'Berry']);
$result->isValid(); // bool(true).
$result->getMessages(); // array(0)

$result = $v->validate(['first_name' => 'Rick']);
$result->isValid(); // bool(false).
$result->getMessages();
/**
 * array(1) {
 *     ["first_name"]=> array(1) {
 *         ["Length::TOO_SHORT"]=> string(53) "first_name is too short and must be 5 characters long"
 *     }
 * }
 */

Features

  • Validate an array of data and get an array of error messages
  • Override the error messages
  • Get the validated data array
  • Validate different contexts (insert, update, ect)
  • IDE auto-completion for easy development

===

Find more information and advanced usage examples at validator.particle-php.com

About

Particle\Validator is a validation library with an extremely clean API which makes validation fun!

http://validator.particle-php.com


Languages

Language:PHP 100.0%