PHP code example of texthtml / json-validator

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

    

texthtml / json-validator example snippets


$validator = \TH\JsonValidator\JsonValidator::create();
$data = json_decode($dataJsonString);
$validator->validate($data, (object)["\$ref" => "file://" . __DIR__."/data-schema.json"]));

$decoder = \TH\JsonValidator\JsonDecoder::create();
$data = $decoder->decode($dataJsonString, (object)["\$ref" => "file://" . __DIR__."/data-schema.json"]));