1. Go to this page and download the library: Download mittwald/psr7-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/ */
$app->post('/customers', $handler)
->add(new ValidationMiddleware(
new class implements ValidatorInterface {
public function validateJson($jsonDocument, ValidationResult $result) {
$result->addErrorForProperty('customernumber', 'Foo');
}
}
));
$app->post('/customers', $handler)
->add(new ValidationMiddleware(
new CombinedValidator(
Factory::buildJsonValidatorFromUri('path/to/schema.json'),
new MyVerySpecialCustomValidator()
)
));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.