2017 © Pedro Peláez
 

library lazy-validator

lazyValidator will start the next group of rules if the current is clear

image

master/lazy-validator

lazyValidator will start the next group of rules if the current is clear

  • Tuesday, November 8, 2016
  • by trzczy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

lazyValidator

lazyValidator will start the next group of rules if the current is clear., (*1)

Code Climate Test Coverage Issue Count, (*2)

Installation

composer require master/lazy-validator, (*3)

Example usage

$validationMethodsObject = new ValidationMethods1($userDaoImpl);
$rulesGrouped = [
    //methods group
    json_decode('
        [
            {
                "method": "length",
                "input": "username",
                "min": 2,
                "max": 3,
                "message": "Username must be between 2 and 3 characters long."
            },
            {
                "method": "length",
                "input": "username",
                "min": 2,
                "max": 8,
                "message": "Username must be between 2 and 8 characters long."
            },
            {
                "method": "regex",
                "input": "username",
                "pattern": "^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$",
                "message": "Username may contain letters, numbers, spaces, hyphens and underscores."
            },
            {
                "method": "email",
                "input": "email",
                "message": "Email address format not proper."
            },
            {
                "method": "length",
                "input": "password",
                "min": 3,
                "max": 4096,
                "message": "Password must be longer than 2 characters."
            },
            {
                "method": "confirm",
                "input": "confirm",
                "message": "Passwords must be the same."
            }
        ]
    ', true),
    //methods group
    json_decode
    ('
        [
            {
                "method": "unique",
                "input": "email",
                "table": "email",
                "message": "Email address must be unique."
            }
        ]
    ', true),
    //methods group
    json_decode
    ('
        [
            {
                "method": "unique",
                "input": "username",
                "table": "username",
                "message": "Username must be unique."
            }
        ]
    ', true)
];
$validator = new LazyValidator($validationMethodsObject);
$result = $validator->validate(
    $_POST,
    $rulesGrouped
);

The Versions

08/11 2016

dev-master

9999999-dev

lazyValidator will start the next group of rules if the current is clear

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar trzczy