1. Go to this page and download the library: Download mrferos/comfort 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/ */
mrferos / comfort example snippets
$json = <<<JSON
{
"first_name": "Andres",
"last_name": "Galindo",
"email": "[email protected]",
"address": {
"street_addr1": "123 Joi lane",
"city": "Miami",
"state": "FL"
}
}
JSON;
$stateArray = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
'CA'=>'CALIFORNIA',
'CO'=>'COLORADO',
'CT'=>'CONNECTICUT',
'DE'=>'DELAWARE',
'DC'=>'DISTRICT OF COLUMBIA',
'FM'=>'FEDERATED STATES OF MICRONESIA',
'FL'=>'FLORIDA',
/** taken out for brevity */
);
$registrationSchema = cmf()->json()->keys([
"first_name" => cmf()->string()->
$data = $registrationSchema($jsonData);
class CustomerStringValidator extends \Comfort\Validator\StringValidator {
public function email()
{
return $this->add(function ($value, $nameKey) {
if (strstr($value, 'test')) {
return $this->createError('string.email', $value, $nameKey);
}
});
}
}
\Comfort\Comfort::registerValidator('string', CustomerStringValidator::class);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.