ir0ny1 / validator
PHP Validator inspired by Illuminate Framework
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:package
pkg:composer/ir0ny1/validator
Requires
- php: >=5.5.0
Requires (Dev)
- codeclimate/php-test-reporter: ^0.2.0@dev
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2025-10-01 22:36:01 UTC
README
#Validation Helper Written By Dave Richer
##For Course: CST8257 Web Application Development
###Release Date: October 17th 2015
###Version: 1.0.0
####Current Valid rules:
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 |
####Example:
$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"); }
####Would Produce Name must be at least six characters long
$val->validationSummary();
Will return an array of all validation messages