1. Go to this page and download the library: Download kilbiller/jarvis 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/ */
kilbiller / jarvis example snippets
use Jarvis\Validator;
use function Jarvis\rules\{between, lengthBetween, noWhiteSpace};
$data = ['age' => 45, 'firstname' => 'Jonathan', 'lastname' => 'Blow'];
$data2 = ['age' => 53, 'firstname' => 'Johnny', 'lastname' => 'Depp'];
$validator = (new Validator())
->addRule('age', between(15, 48));
->addRule('firstname', function ($firstname) {
return $firstname === 'Jonathan';
}, '${key} is not Jonathan.');
->addRule('lastname', [noWhiteSpace(), lengthBetween(0, 50)]),
$validator->validate($data); // -> true
$validator->getErrors(); // -> []
$validator->validate($data2); // -> false
$validator->getErrors(); // -> ['age' => 'age is not valid.', 'firstname' => 'firstname is not Jonathan.']
use Jarvis\Validator;
use function Jarvis\rules\isNumber;
$validator = (new Validator())
->addRule('age', isNumber());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.