Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via composer

justinrainbow/json-schema v5.2.13

A library to validate a json schema.
Package summary
Share
0
issues
1
license
1
MIT
Package created
10 Dec 2011
Version published
26 Sep 2023
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
justinrainbow/json-schema@v5.2.13
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
ⓘ This is a list of justinrainbow/json-schema 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does justinrainbow/json-schema do?

The justinrainbow/json-schema is a PHP implementation for validating JSON structures against a provided schema. This library comes in handy when you want to verify if a JSON adheres to the rules of a specified JSON schema.

How do you use justinrainbow/json-schema?

Utilizing the justinrainbow/json-schema library is fairly straightforward, once installed. Installation can be done via Composer using the command composer require justinrainbow/json-schema. Here's a simple example of how to use it:

<?php

$data = json_decode(file_get_contents('data.json'));

$validator = new JsonSchema\Validator;
$validator->validate($data, (object)['$ref' => 'file://' . realpath('schema.json')]);

if ($validator->isValid()) {
    echo "The supplied JSON validates against the schema.\n";
} else {
    echo "JSON does not validate. Violations:\n";
    foreach ($validator->getErrors() as $error) {
        echo sprintf("[%s] %s\n", $error['property'], $error['message']);
    }
}

In this code, $data is the object instance of the JSON being validated and schema.json is the JSON schema against which $data is being validated.

Where are the justinrainbow/json-schema docs?

The documentation for the justinrainbow/json-schema library is hosted on the json-schema official website. More comprehensive usage examples and detailed descriptions of the library’s features can be found there. Users intending to exploit the library to its full potential are advised to review the documentation carefully. Apart from that, the GitHub repository for this library also serves as a valuable resource for understanding the library and provides several usage and installation instructions.