2017 © Pedro PelĂĄez
 

library json-schema-php

A library to validate a json schema.

image

hypercharge/json-schema-php

A library to validate a json schema.

  • Monday, December 14, 2015
  • by hypercharge
  • Repository
  • 7 Watchers
  • 2 Stars
  • 3,741 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 261 Forks
  • 0 Open issues
  • 12 Versions
  • 1 % Grown

The README.md

JSON Schema for PHP Build Status

A PHP Implementation for validating JSON Structures against a given Schema., (*1)

See json-schema for more details., (*2)

Installation

Library

$ git clone https://github.com/justinrainbow/json-schema.git

Dependencies

Composer (will use the Composer ClassLoader)

$ wget http://getcomposer.org/composer.phar
$ php composer.phar install

Usage

<?php

// Get the schema and data as objects
$retriever = new JsonSchema\Uri\UriRetriever;
$schema = $retriever->retrieve('file://' . realpath('schema.json'));
$data = json_decode(file_get_contents('data.json'));

// If you use $ref or if you are unsure, resolve those references here
// This modifies the $schema object
$refResolver = new JsonSchema\RefResolver($retriever);
$refResolver->resolve($schema, 'file://' . __DIR__);

// 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

$ phpunit

The Versions

14/12 2015

dev-master

9999999-dev https://github.com/hypercharge/json-schema-php

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

14/12 2015

1.3.4

1.3.4.0 https://github.com/hypercharge/json-schema-php

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/06 2013

1.3.3

1.3.3.0 https://github.com/hypercharge/json-schema-php

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/06 2013

dev-schemasuite

dev-schemasuite https://github.com/hypercharge/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