1. Go to this page and download the library: Download aolbrich/request-response 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/ */
aolbrich / request-response example snippets
$validated = $request->validate(
[
'email' => 'tNumber' => 'regex:/^[0-9]+$/',
]
);
print_r($validated); // The fields validated,
print_r($request->validationErrors()); // The fields errored with the error description
// Must preceed the validation
$request->setRule('customRule', function (mixed $value) {
return "If {$value} does not validate, then return error message, if validate return null";
});
$validated = $request->validate(
[
'accountNumber' => 'customRule',
]
);