atelierspierrot / validators
PHP validators for RFC compliance
Installs: 134
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Language:HTML
Requires
- php: >=5.3.0
Requires (Dev)
- phpmd/phpmd: 1.4.*
- phpunit/phpunit: 3.7.*
- sami/sami: dev-master
This package is not auto-updated.
Last update: 2024-03-02 11:44:50 UTC
README
A PHP validators package to test RFC's compliance.
Usage
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 ... }
Installation
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.
Author & License
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