atelierspierrot/validators

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP validators for RFC compliance

v1.1.0 2015-03-04 23:55 UTC

This package is not auto-updated.

Last update: 2024-03-02 11:44:50 UTC


README

Build Status Code Climate documentation

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 if thing passes the validation test
  • sanitize( thing ) which must return a sanitized version of thing 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

http://github.com/atelierspierrot/validators

Copyright (c) 2013-2016 Pierre Cassat and contributors

Licensed under the Apache 2.0 license.

http://www.apache.org/licenses/LICENSE-2.0

Les Ateliers Pierrot - Paris, France

http://www.ateliers-pierrot.fr/ - contact@ateliers-pierrot.fr