Downloads
Stars
Version
composer require yandjin/custom-validation
use the following namespace :
use YanDjin\Validation\CustomValidation;
the validation returns true or false :
$arrayOfData = [
"name" => "YanDjin",
"age" => 26
];
if(!CustomValidation::validateData($arrayOfData, [
"name" => "characters",
"age" => "numeric|min:18" // pipe the validation rules (: for parameters ) or use array "age" => ["numeric", "min" => 18]
]) {
// returns the fields not passing the validation and the errors
return CustomValidation::getErrorsMessagesAsString();
}