PHP code example of plsankar / validateit
1. Go to this page and download the library: Download plsankar/validateit 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/ */
plsankar / validateit example snippets
use \plsankar\ValidateIt\ValidateIt;
$data = array(
"name" => "Some Guy",
"email" => "[email protected]",
"phone" => "1234567890",
"role" => "1",
"address" => "In 3rd Planet",
"zipcode" => "000000"
);
$rules = [
"name",
"email:EMAIL",
"phone:PHONE",
"role:INT"
];
ValidateIt::isValid($data, $rules) // true or false
echo "isvalid: " . (ValidateIt::isValid($data, $rules) ? "ok" : "not");