PHPackages                             bobahbi44/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. bobahbi44/json-schema

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

bobahbi44/json-schema
=====================

High definition PHP structures with JSON-schema based validation

0.0.4(3y ago)07MITPHPPHP &gt;=5.4

Since Apr 4Pushed 3y agoCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

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)[![codecov](https://camo.githubusercontent.com/948d49a0d80c232521964081e5d6b383e92f8733abfceb1bc177af0c955c52b6/68747470733a2f2f636f6465636f762e696f2f67682f73776167676573742f7068702d6a736f6e2d736368656d612f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/swaggest/php-json-schema)[![time tracker](https://camo.githubusercontent.com/950ffced984d1bd786b1452d313ffa316ad40afee0b90f97144f7039859d8391/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f73776167676573742f7068702d6a736f6e2d736368656d612e737667)](https://wakatime.com/badge/github/swaggest/php-json-schema)[![Code lines](https://camo.githubusercontent.com/4eddbf4b3a47e05d61273bcb5e3d901955201a4a83c11cfd60934c33328adf2d/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f7068702d6a736f6e2d736368656d612f3f63617465676f72793d636f6465)](https://camo.githubusercontent.com/4eddbf4b3a47e05d61273bcb5e3d901955201a4a83c11cfd60934c33328adf2d/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f7068702d6a736f6e2d736368656d612f3f63617465676f72793d636f6465)[![Comments](https://camo.githubusercontent.com/cd482d20881ed7997095a5432b6cc10a2d0177b8659320e09dfb54a3f554f1ec/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f7068702d6a736f6e2d736368656d612f3f63617465676f72793d636f6d6d656e7473)](https://camo.githubusercontent.com/cd482d20881ed7997095a5432b6cc10a2d0177b8659320e09dfb54a3f554f1ec/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f7068702d6a736f6e2d736368656d612f3f63617465676f72793d636f6d6d656e7473)

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 bobahbi44/php-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 =
