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

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

    

ixnode / php-json-schema-validator example snippets


use Ixnode\PhpJsonSchemaValidator\Validator;

$data = '[1, 2, 3]';

$schema = [
    'type' => 'object'
];

$validator = new Validator(new Json($data), new Json($schema));

$valid = $validator->validate();
// (bool) true
bash
vendor/bin/php-json-schema-validator -V
bash
php-json-schema-validator 0.1.0 (12-31-2022 15:51:08) - Björn Hempel <[email protected]>
bash
git clone [email protected]:ixnode/php-json-schema-validator.git && cd php-json-schema-validator