Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/litto/validator

Validating Class for Form submissions
https://github.com/litto/validator

Last synced: about 2 months ago
JSON representation

Validating Class for Form submissions

Awesome Lists containing this project

README

        

# Validator class
Validating Class for Form submissions

##How to Install?

You can install the package using composer by typing the command

composer require litto/validator:v1.0

##How it Works?

$rules = array(
"firstName"=>"LABEL1/EMPTY",
"lastName"=>"LABEL2/EMPTY",
"email"=>"LABEL3/EMAIL|EMPTY",
"website"=>"LABEL4/URL",
"price"=>"LABEL5/NUMBER|EMPTY",
);
$obj = new Validator($rules);
if($obj -> validate()){
echo "Validation Success";
}else{
echo $obj->getMessage();
}

After Form submission, just initialise the validator class and pass the validate rules