recommerce/json-lib

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.0.6) of this package.

0.0.6 2016-02-26 10:44 UTC

This package is not auto-updated.

Last update: 2023-03-17 08:29:55 UTC


README

Build Status Code Climate Test Coverage

Recommerce json-lib

This library provides json validation feature (based on justinrainbow/json-schema).

Installation with composer

composer require recommerce/json-lib:^0.0
composer update

Usage examples

Json file validation

    use Recommerce\Json\Content\FileContent;
    use Recommerce\Json\Exception\JsonException;
    use Recommerce\Json\Validator;

    $jsonSchema = new FileContent('my-json-schema-file.json');
    $jsonContent = new EncodedContent('{"attribute": "value"}');

    try {
        $validator = new Validator($jsonSchema);
        $validator->validate($jsonContent); // throw exception on failure
    } catch (JsonException $e) {

    }