A PHP validators package to test RFC's compliance.
All validators must implement the \Validator\ValidatorInterface
which defines two methods:
validate( thing )
which must return a boolean value indicating ifthing
passes the validation testsanitize( thing )
which must return a sanitized version ofthing
that must pass the validation test
Example usage of the \Validator\EmailValidator
(use the same process for each validator):
$thing = 'my.address@email.com';
$v = new \Validator\EmailValidator();
if ($v->validate($thing)) {
// $thing is OK ...
} else {
// $thing is KO ...
$new_thing = $v->sanitize($thing);
// $new_thing must be OK ...
}
For a complete information about how to install this package and load its namespace, please have a look at our USAGE documentation.
If you are a Composer user, just add the package to the
requirements of your project's composer.json
manifest file:
"atelierspierrot/validators": "@stable"
You can use a specific release or the latest release of a major version using the appropriate version constraint.
Validators
Copyright (c) 2013-2016 Pierre Cassat and contributors
Licensed under the Apache 2.0 license.
Les Ateliers Pierrot - Paris, France
http://www.ateliers-pierrot.fr/ - contact@ateliers-pierrot.fr