Skip to content

A validation class to validate and check if exists for variables.

License

Notifications You must be signed in to change notification settings

aradhell/request-variable-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sample usage

composer require alpercevik/request-variable-validation
use RequestVariableValidation\RequestVariableValidation;
require_once '/vendor/autoload.php'; // composer autoloader

$APIRequestVariableValidation = RequestVariableValidation::getInstance();

$rules = array(
    "lang" => array("type"=>"letters","max_length" =>2, "min_length"=>2),
    "offset" => array("type"=>"numbers","max_length" =>2, "min_length"=>1),
    "count" => array("type"=>"numbers","max_length" =>2, "min_length"=>1)
);

$result = $APIRequestVariableValidation->checkVariableIfExists($_GET, $rules);

returns

$result['status'] = 0;  // 0: Error, 1: Success
$result['message'] = "" // If an error occured

About

A validation class to validate and check if exists for variables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages