1. Go to this page and download the library: Download revenuewire/validator 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/ */
revenuewire / validator example snippets
//example of testing my age
$validator = new \RW\Validator();
$result = $validator->validateAge(20, "myAge", ["min" => 18, "max" => 99]);
var_dump($result); //true
//same validator, but using birthday
$validator = new \RW\Validator();
$result = $validator->validateAge("1987-01-08", "myAge", ["min" => 18, "max" => 99]);
var_dump($result); //true
$validator = new \RW\Validator();
$result = $validator->validateAge(16, "myAge", ["min" => 18, "max" => 99]);
var_dump($result); //false
/**
* [
* "key" => "myAge",
* "error" => "myAge must be greater than 18.",
* "contexts" => [
* "min" => 18, "max" => 99
* ]
* ]
*/
var_dump($validator->getValidateResult());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.