PHP code example of dez-php / dez-data-validation
1. Go to this page and download the library: Download dez-php/dez-data-validation 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/ */
dez-php / dez-data-validation example snippets
$validation = new Validation($_GET);
$email = $validation->rror. Field :field']));
$passkey = $validation->->add(new Callback(function($value) {
return $value > 1024;
}, "Wrong passkey"));
$validation->callback('access', function($value){
return $value > 2048;
}, "You do not have permissions");
$validation->validate(); // true|false
$validation->isFailure();
foreach($validation->getMessages() as $field => $messages) {
foreach($messages as $message) {
echo $field . ' -> ' . $message->getMessage() . PHP_EOL;
}
}