2017 © Pedro PelĂĄez
 

library php-json-schema

A library to validate a json schema.

image

robotdance/php-json-schema

A library to validate a json schema.

  • Thursday, June 30, 2016
  • by MarcosMenegazzo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 260 Forks
  • 0 Open issues
  • 31 Versions
  • 0 % Grown

The README.md

JSON Schema for PHP

Code Climate Test Coverage Issue Count Build Status, (*1)

A PHP json-schema implementation for validating JSON data agains a JSON Schema definition., (*2)

Originally forked from justinrainbow/json-schema., (*3)

In addition to the original, I18n was added for the validation messages, with initial support for en-US and pt-BR. Currently the branch "add-i18n" will be kept in sync with the forked repository, and the master branch will follow its own way., (*4)

Installation

PHP-Json-Schema is available as a Composer package, and use it also as its dependency manager. So you will need a composer.json in your project root, requiring php-json-schema:, (*5)

  ...
  "require": {
    "robotdance/php-json-schema": "latest stable version"
  }
  ...

So after updating your composer file, simply update composer., (*6)

$ php composer.phar update
$ composer update

The way you update with composer will depend on how you installed composer., (*7)

Usage

<?php

// Get the schema and data as objects
// If you use $ref or if you are unsure, resolve those references here
// This modifies the $schema object
$refResolver = new JsonSchema\RefResolver(new JsonSchema\Uri\UriRetriever(), new JsonSchema\Uri\UriResolver());
$schema = $refResolver->resolve('file://' . realpath('schema.json'));

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

// Validate
$validator = new JsonSchema\Validator();
$validator->check($data, $schema);

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']);
    }
}

Running the tests

$ vendor/bin/phpunit

The Versions

29/06 2016
29/06 2016

dev-add-i18n

dev-add-i18n https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

29/06 2016
02/06 2016

2.0.5

2.0.5.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

24/05 2016

2.0.4

2.0.4.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

10/05 2016

2.0.3

2.0.3.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

09/05 2016

2.0.2

2.0.2.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

28/04 2016

2.0.1

2.0.1.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

14/04 2016

2.0.0

2.0.0.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

25/01 2016

1.6.1

1.6.1.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.29

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

06/01 2016

1.6.0

1.6.0.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

09/09 2015

1.5.0

1.5.0.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

14/07 2015

1.4.4

1.4.4.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

13/07 2015

1.4.3

1.4.3.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

14/06 2015

1.4.2

1.4.2.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

27/03 2015

1.4.1

1.4.1.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

23/03 2015

1.4.0

1.4.0.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

25/08 2014

1.3.7

1.3.7.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

05/03 2014

1.3.6

1.3.6.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

13/12 2013

1.3.5

1.3.5.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

08/12 2013

1.3.4

1.3.4.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

22/07 2013

1.3.3

1.3.3.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

10/06 2013

1.3.2

1.3.2.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Bruno Prieto Reis
by Justin Rainbow

schema json

21/02 2013

1.3.1

1.3.1.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Bruno Prieto Reis
by Justin Rainbow

schema json

18/02 2013

1.3.0

1.3.0.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Bruno Prieto Reis
by Justin Rainbow

schema json

31/01 2013

1.2.4

1.2.4.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Bruno Prieto Reis
by Justin Rainbow

schema json

29/01 2013

1.2.3

1.2.3.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Bruno Prieto Reis
by Justin Rainbow

schema json

18/08 2012

1.2.1

1.2.1.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Bruno Prieto Reis
by Justin Rainbow

schema json

04/06 2012

dev-schema-builder

dev-schema-builder https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

BSD-3-Clause

The Requires

 

by Bruno Prieto Reis
by Justin Rainbow

schema json

03/01 2012

1.1.0

1.1.0.0 https://github.com/justinrainbow/json-schema

A library to validate a json schema.

  Sources   Download

NewBSD

The Requires

  • php >=5.3.0

 

by Bruno Prieto Reis
by Justin Rainbow

schema json