1. Go to this page and download the library: Download timefrontiers/php-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/ */
timefrontiers / php-validator example snippets
use TimeFrontiers\Validation\Validator;
$result = Validator::field('email', $_POST['email'])
->mail
} else {
echo $result->first(); // First error message
}
$result->passes(); // bool - validation passed
$result->fails(); // bool - validation failed
$result->validated(); // array - all validated values
$result->get('email'); // mixed - single validated value
$result->errors(); // array - all errors
$result->errorsFor('email'); // array - errors for field
$result->hasError('email'); // bool - field has errors
$result->first(); // string|null - first error
$result->first('email'); // string|null - first error for field
$result->messages(); // array - flat list of all messages
$result->throwIfFailed(); // throws ValidationException