ibandominguez / validator
validation class to take care of repetitive tasks
v1.2.1
2016-10-06 16:03 UTC
Requires
- php: >= 5.3.0
Requires (Dev)
README
validator is a helper class for repetitive validation processes.
Getting Started
Clone or Download this package or install via composer
composer require ibandominguez/validator
Available Rules by '20/Jun/15'
Title | Description |
---|---|
required | check if the given input exists and it is not empty |
check if the given input is a valid email | |
array | check if the given input is a valid array |
numeric | check if the given input is a numeric value |
string | check if the given input is a string value |
date | check if the given input is a date value with the format (yyyy-mm-dd) |
datetime | check if the given input is a datetime value with the format (yyyy-mm-dd hh:ii:ss) |
time | check if the given input is a time value with the format (hh:ii:ss) |
Rules Roadmap
- min
- max
- between
- date format
- alpha
- alpha numeric
Use example
In your application:
<?php require __DIR__.'/vendor/autoload.php'; $inputs = array('name' => '', 'email' => 'johndoe@email.com'); $rules = array('name' => 'required', 'email' => 'required|email'); $v = new IbanDominguez\Validator\Validator($inputs, $rules); $v->passes(); // => false $v->getErrors(); // => array('name' => 'name, rule: required');
License
MIT © Ibán Domínguez