PHP code example of hskrasek / jsonschema-input-validator

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

    

hskrasek / jsonschema-input-validator example snippets

 php


use HSkrasek\JSONSchema\Validator;

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

if ($validator->fails()) {
    $problemDetails = $validator->getProblemDetails();
    
    // Render problem details somehow
    return json_encode($problemDetails);
}