2017 © Pedro Peláez
 

library json

Encodes, decodes, and validates JSON data.

image

kherge/json

Encodes, decodes, and validates JSON data.

  • Wednesday, June 7, 2017
  • by kherge
  • Repository
  • 2 Watchers
  • 37 Stars
  • 32,542 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 9 Forks
  • 1 Open issues
  • 8 Versions
  • 9 % Grown

The README.md

Build Status Packagist Packagist Pre Release, (*1)

JSON

A library for encoding, decoding, linting, and validating JSON data., (*2)

This library provides a simplified interface into existing functionality that is provided by PHP's json extension, justinrainbow/json-schema, and also seld/jsonlint. The purpose is to make it easy to use while making it hard to miss errors., (*3)

Usage

<?php

use KHerGe\JSON\JSON;

$json = new JSON();

// Decode JSON values.
$decoded = $json->decode('{"test":123}');

// Decode JSON values in files.
$decoded = $json->decodeFile('/path/to/file.json');

// Encode native values.
$encoded = $json->encode(['test' => 123]);

// Encode native values into files.
$json->encodeFile(['test' => 123], '/path/to/file.json');

// Lint an encoded JSON value.
$json->lint('{"test":}');

// Lint an encoded JSON value in a file.
$json->lintFile('/path/to/file.json');

// Validate a decoded JSON value using a JSON schema.
$json->validate(
    $json->decodeFile('/path/to/schema.json'),
    $decoded
);

Documentation

The JSONInterface interface is your best resource. The JSON class you will be using implements this interface and contains all of the information you will need., (*4)

Requirements

  • PHP 7.3+
    • json

Installation

composer require kherge/json=^3

License

This library is released under the MIT and Apache 2.0 licenses., (*5)

The Versions

07/06 2017

dev-master

9999999-dev

Encodes, decodes, and validates JSON data.

  Sources   Download

MIT Apache-2.0

The Requires

 

json validate encode decode

07/06 2017

2.1.0

2.1.0.0

Encodes, decodes, and validates JSON data.

  Sources   Download

MIT Apache-2.0

The Requires

 

json validate encode decode

13/01 2017

2.0.0

2.0.0.0

Encodes, decodes, and validates JSON data.

  Sources   Download

MIT Apache-2.0

The Requires

 

json validate encode decode

30/10 2013

1.x-dev

1.9999999.9999999.9999999-dev http://herrera-io.github.com/php-json

A library for simplifying JSON linting and validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

schema lint json validate

30/10 2013

1.0.3

1.0.3.0 http://herrera-io.github.com/php-json

A library for simplifying JSON linting and validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

schema lint json validate

20/03 2013

1.0.2

1.0.2.0 http://herrera-io.github.com/php-json

A library for simplifying JSON linting and validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

schema lint json validate

18/03 2013

1.0.1

1.0.1.0 http://herrera-io.github.com/php-json

A library for simplifying JSON linting and validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

schema lint json validate

09/03 2013

1.0.0

1.0.0.0 http://herrera-io.github.com/php-json

A library for simplifying JSON linting and validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

schema lint json validate