1. Go to this page and download the library: Download h2lsoft/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/ */
h2lsoft / validator example snippets
$validator = new \h2lsoft\Data\Validator();
$validator->input('name')->dator->input('age')->
// default: locale 'en', data from $_POST
$v = new \h2lsoft\Data\Validator();
// with locale
$v = new \h2lsoft\Data\Validator('fr');
// with custom data
$v = new \h2lsoft\Data\Validator('en', ['name' => 'John', 'age' => 25]);
$v->input('name')->integer(true, 'Age must be a positive number');
$v->input('email', 'Email')->ty"
$v->addError('Something went wrong', [], 'field_name');
// check that a promo code exists in database
$v->input('promo_code')->d promo code');
// check that an email is not already taken
$v->input('email')->ount')->ry');
$v = new \h2lsoft\Data\Validator('fr');
// or after creation
$v->setLocale('es');