Download the PHP package ropi/json-path-evaluator without Composer
On this page you can find all versions of the php package ropi/json-path-evaluator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package json-path-evaluator
A JSONPath evaluator for PHP
This library is a PHP based implementation of JSONPath (RFC 9535).
It allows to evaluate JSONPath expressions directly on PHP objects and/or arrays.\ This implementation passes all compliance tests of JSONPath Compliance Test Suite.
Requirements
- PHP >= 8.1
- ext-ctype
- ext-intl
- ext-mbstring
Table of contents
- Installation
- Examples
- Get values
- Get paths
- Set values
- Set values and create non-existent paths
- Delete paths
- Custom function extensions
Installation
The library can be installed from a command line interface by using composer.
Examples
Get values
The following example shows how to get values that match a JSONPath.\ The result is always an array of values that match the JSONPath. If there are no matches, an empty array is returned.
The above example will output:
Get paths
The following example shows how to get value paths that match a JSONPath, where each value path is represented as normalized JSONPath according to section 2.7 of RFC 9535.\ The result is always an array of matched paths. If there are no matches, an empty array is returned.
The above example will output:
Set values
The following example shows how to set/replace values.
The above example will output:
Set values and create non-existent paths
The following example shows how to set values on non-existent paths.
The above example will output:
Delete paths
The following example shows how to delete/remove/unset paths that match a JSONPath.
The above example will output:
Custom function extensions
The following example shows how to register custom function extensions according to section 2.4 of RFC 9535.
The above example will output:
All versions of json-path-evaluator with dependencies
ext-intl Version *
ext-mbstring Version *
php Version >=8.1.0