2017 © Pedro Peláez
 

library php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

image

php-jsonpointer/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 13 Versions
  • 15 % Grown

The README.md

JSON Pointer for PHP

Test Version PHP Version, (*1)

This is an implementation of JSON Pointer written in PHP. Triggered by @janl's node.js implementation and being a bit bored., (*2)

Installation via Composer

``` bash composer require php-jsonpointer/php-jsonpointer, (*3)


### Usage Now you can use JSON Pointer for PHP via the available Composer **autoload file**. ``` php <?php require_once 'vendor/autoload.php'; use Rs\Json\Pointer; use Rs\Json\Pointer\InvalidJsonException; use Rs\Json\Pointer\NonexistentValueReferencedException; $invalidJson = '{"Missing colon" null}'; try { $jsonPointer = new Pointer($invalidJson); } catch (InvalidJsonException $e) { $message = $e->getMessage(); // Cannot operate on invalid Json. Message: Parse error on line 1: ... } $json = '{"foo":1,"bar":{"baz":2},"qux":[3,4,5],"m~n":8,"a/b":0,"e^f":3}'; $jsonPointer = new Pointer($json); try { $all = $jsonPointer->get(""); // string('{"foo":1,"bar":{"baz":2},"qux":[3,4,5],"m~n":8,"a/b":0,"e^f":3}') $one = $jsonPointer->get("/foo"); // int(1) $two = $jsonPointer->get("/bar/baz"); // int(2) $three = $jsonPointer->get("/qux/0"); // int(3) $four = $jsonPointer->get("/qux/1"); // int(4) $five = $jsonPointer->get("/qux/-"); // int(5) $five = $jsonPointer->get("/qux/" . Pointer::LAST_ARRAY_ELEMENT_CHAR); // int(5) $zero = $jsonPointer->get("/a~1b"); // int(0) $eight = $jsonPointer->get("/m~0n"); // int(8) $three = $jsonPointer->get("/e^f"); // int(3) $nonexistent = $jsonPointer->get("/qux/7"); } catch (NonexistentValueReferencedException $e) { $message = $e->getMessage(); // Json Pointer '/qux/7' reference a nonexistent value }

Running tests

bash composer test, (*4)

License

This library is licensed under the MIT License. Please see LICENSE for more information., (*5)

Changelog

Please see CHANGELOG for more information., (*6)

Contributing

Please see CONTRIBUTING for more information., (*7)

The Versions

15/06 2018

dev-master

9999999-dev https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

json json pointer json traversal

29/08 2016

v3.0.2

3.0.2.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

json json pointer json traversal

25/08 2016

v3.0.1

3.0.1.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

json json pointer json traversal

22/08 2016

v3.0.0

3.0.0.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

json json pointer json traversal

12/08 2016

v2.0.1

2.0.1.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

json json pointer json traversal

20/06 2016

v2.0.0

2.0.0.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

json json pointer json traversal

10/04 2016

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

json json pointer json traversal

05/06 2015

1.1.x-dev

1.1.9999999.9999999-dev https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

json json pointer json traversal

21/05 2015

v1.1.0

1.1.0.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

json json pointer json traversal

02/12 2014

v1.1.0-RC1

1.1.0.0-RC1 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

 

json json pointer json traversal

19/04 2013

v1.0.0-RC2

1.0.0.0-RC2 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

 

json json pointer json traversal

12/04 2013

v1.0.0-RC1

1.0.0.0-RC1 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)

  Sources   Download

MIT

The Requires

 

json json pointer json traversal

20/11 2012

v0.0.1

0.0.1.0 https://github.com/raphaelstolt/php-jsonpointer

Implementation of JSON Pointer (http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-00)

  Sources   Download

MIT

The Requires

 

json json pointer