2017 © Pedro Peláez
 

library dynamic-form-validation

PHP Dynamic form validation

image

bigpaulie/dynamic-form-validation

PHP Dynamic form validation

  • Sunday, August 14, 2016
  • by bigpaulie
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

dynamic-form-validator Build Status

This is a simple PHP library for dynamic form validation. It was written with my own needs in mind, it may not be the best library but it does the job for me., (*1)

Installation

Install the package via composer using :, (*2)

composer require --prefer-dist bipaulie/dynamic-form-validation

Usage

First you should get an instance for the validator, pass it the rules array and data to be validated., (*3)

$rules = ['/input_name_([0-9]+)/i' => 'filter_name'];

$validator = new Validator();
$validator->setRules($rules)->setRequest($request);

try {
    if ( $validator->run() ) {
        echo "Validation successful.";
    } else {
        echo "Validation failed.";
    }
} catch ( \Exception $e ) {
    echo $e->getMessage();
}

Available filters

String validation

The "string" filter validates strings of characters containging : letters, numbers, spaces, dots and hyphens., (*4)

Date validation

The "date" filter validates dates of the follwing formats :, (*5)

* d/m/Y
* m/d/Y
* d/m/y
* m/d/y

Email validation

The "email" filter validates email addresses, (*6)

Numeric validation

The "numerical" filter validates numerical values such as integers and floats, (*7)

Password validation

The "password" filter validates passwords of the following format: - Has at least one uppercase letter - Has at least one number - Has at least one special character (!,@,#,$) - Is at least 8 characters long, (*8)

Examples

Checkout the examples directory form some examples on how to use the validator., (*9)

Contribution

If you like the library and you feel like something is missing or fix a potential bug, please feel free to submit a pull request, if I like your idea or it's useful I will merge it with the repository., (*10)

A final note about this library. I'm using "git flow" to manage this repository, the main branch here is called "develop" not master., (*11)

Thank you for using and contributing., (*12)

The Versions

14/08 2016

dev-develop

dev-develop

PHP Dynamic form validation

  Sources   Download

MIT

The Requires

 

30/07 2016

dev-master

9999999-dev

PHP Dynamic form validation

  Sources   Download

MIT

The Requires

 

30/07 2016

1.0.1

1.0.1.0

PHP Dynamic form validation

  Sources   Download

MIT

The Requires

 

30/07 2016

1.0.0

1.0.0.0

PHP Dynamic form validation

  Sources   Download

MIT

The Requires