PHP code example of mszewcz / php-json-schema-validator

1. Go to this page and download the library: Download mszewcz/php-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/ */

    

mszewcz / php-json-schema-validator example snippets






try {
    $utils      = new MS\Json\Utils\Utils();
    $schema     = $utils->decode($jsonSchemaDefinition);
    $json       = $utils->decode($jsonToValidate);
    $validator  = new MS\Json\SchemaValidator\Validator($schema);
    $result     = $validator->validate($json);
} catch (\Exception $e) {
    echo $e->getMessage();
}

$schema = \json_decode($jsonSchemaDefinition, true);
$json   = \json_decode($jsonToValidate, true);
mszewcz/php-json-schema-validator

{
    "  "mszewcz/php-json-schema-validator": ">=1.0"
    }
}