1. Go to this page and download the library: Download progsmile/request-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/ */
progsmile / request-validator example snippets
$rules = [
# firstname and lastname must be present
# they should be alphanumeric
# atleast 2 characters
'firstname, lastname' => ' => ['email', MyCustomRule::class],
# must be numeric
'id' => 'numeric',
'age' => ['min:16', 'numeric'],
'info[country]' => ['e number should follow the format
# correct: +38(123)456-12-34
# wrong: +38(123)56-123-56
# wrong: +39(123)456-12-34
'phoneMask' => 'phoneMask:(+38(###)###-##-##)',
'randNum' => 'between:1, 10|numeric',
# the value must be an IP Format
'ip' => 'ip',
'password' => 'mail :value: is not unique',
'elevatorFloor.notIn' => 'Oops',
];
$validation = \Progsmile\Validator\Validator::make($_POST, $rules, $customMessage);
# for specific field
# you can use below code.
$validation->lastname->passes();
$validation->lastname->fails();
# if you're
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.