PHP code example of alpercevik / request-variable-validation

1. Go to this page and download the library: Download alpercevik/request-variable-validation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alpercevik / request-variable-validation example snippets


use RequestVariableValidation\RequestVariableValidation;
on::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);

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