PHPackages                             devlabs91/json-schema - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. devlabs91/json-schema

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

devlabs91/json-schema
=====================

High definition PHP structures with JSON-schema based validation

v0.12.7(7y ago)03.7k1MITPHPPHP &gt;=5.4

Since Jan 29Pushed 7y agoCompare

[ Source](https://github.com/devlabs91/php-json-schema)[ Packagist](https://packagist.org/packages/devlabs91/json-schema)[ RSS](/packages/devlabs91-json-schema/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (7)Versions (41)Used By (1)

Swaggest JSON-schema implementation for PHP
===========================================

[](#swaggest-json-schema-implementation-for-php)

[![Build Status](https://camo.githubusercontent.com/b4428d0edfa8d8268be2394ca42bd6d6a694c99158226bacea2c70c6beb20ad0/68747470733a2f2f7472617669732d63692e6f72672f73776167676573742f7068702d6a736f6e2d736368656d612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/swaggest/php-json-schema)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8f6127f6222a448117e24a2110d16382fa3d7ae78a5800c1645c32b5fe39c509/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73776167676573742f7068702d6a736f6e2d736368656d612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/swaggest/php-json-schema/?branch=master)[![Code Climate](https://camo.githubusercontent.com/a6516e4025ebffe6c659226333347b88958fd3b47d0850a79140686b3558b7d1/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f73776167676573742f7068702d6a736f6e2d736368656d612f6261646765732f6770612e737667)](https://codeclimate.com/github/swaggest/php-json-schema)[![Code Coverage](https://camo.githubusercontent.com/bf8689a5cd3cdd31ee71bcc9eea8c7af7bb142a3776e5e2d9f6932440e174ec7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73776167676573742f7068702d6a736f6e2d736368656d612f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/swaggest/php-json-schema/code-structure/master/code-coverage/src/)

High definition PHP structures with JSON-schema based validation.

Supported schemas:

- [JSON Schema Draft 7](http://json-schema.org/specification-links.html#draft-7)
- [JSON Schema Draft 6](http://json-schema.org/specification-links.html#draft-6)
- [JSON Schema Draft 4](http://json-schema.org/specification-links.html#draft-4)

Installation
------------

[](#installation)

```
composer require swaggest/json-schema

```

Usage
-----

[](#usage)

Structure definition can be done either with `json-schema` or with `PHP` class extending `Swaggest\JsonSchema\Structure\ClassStructure`

### Validating JSON data against given schema

[](#validating-json-data-against-given-schema)

Define your json-schema

```
$schemaJson =
