PHP code example of abacaphiliac / zend-json-schema-validator
1. Go to this page and download the library: Download abacaphiliac/zend-json-schema-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/ */
abacaphiliac / zend-json-schema-validator example snippets
$validator = new \Abacaphiliac\Zend\Validator\JsonSchema(array(
'file' => '/path/to/your/schema.json',
));
if (!$validator->isValid('{"Foo":"Bar"}')) {
$validationMessages = $validator->getMessages();
}
return array(
'input_filter_specs' => array(
'YourApi\\V1\\Rest\\YourService\\Validator' => array(
array(
'name' => 'YourJsonParam',
'validators' => array(
array(
'name' => 'IntegrationConfiguration\\Validator\\JsonSchema',
'options' => array(
'file' => dirname(dirname(dirname(__DIR__))) . '/config/json-schema/IntegrationConfiguration/V1/Rest/OutboundDocumentation/configurations-config.json',
),
),
)
),
),
),
);