2017 © Pedro Peláez
 

library jsonor

Useful container for JSON. Use JSON as array

image

bzick/jsonor

Useful container for JSON. Use JSON as array

  • Monday, August 15, 2016
  • by bzick
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,434 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

JSON Container

Build Status, (*1)

Usage

use Jsonor\JSON;


// returns null if it's valid json, or a ParsingException object.
JSON::lint($json);

// Call getMessage() on the exception object to get
// a well formatted error message error like this

// Parse error on line 2:
// ... "key": "value"    "numbers": [1, 2, 3]
// ----------------------^
// Expected one of: 'EOF', '}', ':', ',', ']'

// Call getDetails() on the exception to get more info.

// returns parsed json, like json_decode() does
$data = JSON::decode($json);
// sets yours callback on changes
$data->onChange(function () {
    // store in DB, e.g.
});
// Use $data as array
$data["d"][1]["name"] = "Banana";
$data["d"][1]["desc"] = "It's fruit";
$data["d"][] = [
    "name" => "Apple"
];

unset($c["d"][1]);

foreach($data as $key => $value) {
    // ...
}

Installation

For a quick install with Composer use:, (*2)

$ composer require bzick/jsonor

Jsonor can easily be used within another app if you have a PSR-4 autoloader, or it can be installed through Composer for use as a CLI util., (*3)

Requirements

  • PHP 5.4+
  • [optional] PHPUnit 3.5+ to execute the test suite (phpunit --version)

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub, (*4)

Author

Ivan Shalganov - a.cobest@gmail.com, (*5)

License

Jsonor is licensed under the MIT License - see the LICENSE file for details, (*6)

The Versions

15/08 2016

dev-master

9999999-dev

Useful container for JSON. Use JSON as array

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Shalganov

container json wrapper object

15/08 2016

1.0.1

1.0.1.0

Useful container for JSON. Use JSON as array

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Shalganov

container json wrapper object

30/07 2016

1.0.0

1.0.0.0

Useful container for JSON. Use JSON as array

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Shalganov

container json wrapper object