dev-master
9999999-dev https://www.develops.ioPHP Validator inspired by Illuminate Framework
MIT
The Requires
- php >=5.5.0
The Development Requires
by Dave Richer
php validator validation
Wallogit.com
2017 © Pedro Peláez
PHP Validator inspired by Illuminate Framework
| Rule | Description |
|---|---|
| required | Field is required |
| sameAs:property | Field is same has property |
| minLength:number | Field is at least number characters long |
| maxLength:number | Field is not longer then number characters long |
| equalTo:value | Field Equals Value |
| phoneNumber | Field is in (NNN) NNN-NNNN format |
| postalCode | Field is in A0A0A0 or A0A 0A0 format |
| emailAddress | Field is a valid email address |
| complexPassword | Field is a complex password with 1 capital, 1 lowercase, 1 numeric, 1 special character and a minimum of six characters long |
$rules = [
"name" => "required:min:6"
];
$data = [
"name" => "Dave"
];
// Set the data and rules when creating the object
$val = new Validator($data, $rules);
// Or after..
$val->setData($data);
$val->setRules($rules);
// Or chain
$val->setData($data)->setRules($rules);
// Either validate with the validate method
$val->validate();
// Or validate by invoking the object itself
$val();
if (!val->valid()) {
echo $val->validationMessageFor("name");
}
Name must be at least six characters long, (*2)
$val->validationSummary();
Will return an array of all validation messages, (*3)
PHP Validator inspired by Illuminate Framework
MIT
php validator validation