Opis JSON Schema

Installation, licensing and requirements

Opis JSON Schema is a PHP implementation for the JSON Schema standard (draft-2020-12, draft-2019-09, draft-07 and draft-06), that will help you validate all sorts of JSON documents, whether they are configuration files or a set of data sent to an RESTful API endpoint.

Features

  • Fast validation
  • Support for custom filters
  • Supports relative and absolute json pointers
  • Support for local and global variables
  • Advanced schema reuse with mappers
  • Intuitive schema composition using slots
  • Support for $data keyword
  • Support for custom formats and media types
  • And, of course, all the json schema keywords

Please check the migration guide.

License

Opis JSON Schema is licensed under Apache License, Version 2.0.

Requirements

  • PHP 7.4 or higher (PHP 8 is recommended)

Installation

Opis JSON Schema is available on Packagist and it can be installed from a command line interface by using Composer.

composer require opis/json-schema

Or you could directly reference it into your composer.json file as a dependency

{
    "require": {
        "opis/json-schema": "^2.0"
    }
}

Documentation

On this site you can find documentation about json schema itself and about the API of this library.

JSON Schema keywords

Schema structure