Download the PHP package remorhaz/php-json-pointer without Composer
On this page you can find all versions of the php package remorhaz/php-json-pointer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download remorhaz/php-json-pointer
More information about remorhaz/php-json-pointer
Files in remorhaz/php-json-pointer
Package php-json-pointer
Short Description JSON Pointer (RFC-6901) PHP implementation
License MIT
Homepage https://github.com/remorhaz/php-json-pointer
Informations about the package php-json-pointer
PHP JSON Pointer
This library implements RFC6901-compliant JSON pointers.
Requirements
- PHP 8.1
Features
- Selecting part of a JSON document.
- Removing part of a JSON document.
- Replacing/adding part of a JSON document.
Installation
You will need composer to perform install.
Documentation
Accessing JSON document
You can create accessible JSON document either from encoded JSON string or from decoded JSON data using corresponding node value factory:
Creating query
You should use query factory to create query from JSON Pointer expression:
Processing query
You should use an instance of query processor to execute queries on given JSON documents:
Selecting part of a JSON document
To get part of a JSON document use ::select()
method.
Note that you can either encode result of a selection to JSON string or decode them to raw PHP data. Before accessing a result of ::select()
you can check it's existence with ::exists()
method to avoid exception.
Deleting part of a JSON document
To delete part of a JSON document use ::delete()
method.
Note that ::delete()
function returns non-existing result if query points to non-existing value.
Replacing part of a JSON document
To replace part of a JSON document use ::replace()
method.
Adding part of a JSON document
To add part of a JSON document use ::add()
method.
If query points to existing property it will be replaced. Note that you can add values only to existing objects/arrays.
License
PHP JSON Pointer is licensed under MIT license.
All versions of php-json-pointer with dependencies
remorhaz/php-json-data Version ^0.7
remorhaz/php-unilex Version ^0.5.3