1. Go to this page and download the library: Download gp/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/ */
gp / validator example snippets
$isValid = $field->validate();
if ($isValid) {
echo "The field is valid.";
} else {
echo "The field is invalid. Errors: " . implode(', ', $field->getErrors());
}
$isValid = $fields->validate();
if ($isValid) {
echo "All fields are valid.";
} else {
print_r($fields->getErrors()); // print errors
print_r($fields->getInvalidFields());// print invalidFieldDetails
}
use Validator\ValidationEngine;
$validationEngine = new ValidationEngine(); $invalidFieldDetails = [];
$isValid = $validationEngine->validate($fields, true, $invalidFieldDetails);
if ($isValid) {
echo "All fields are valid.";
} else {
print_r($invalidFieldDetails); // View details of invalid fields
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.