Download the PHP package loilo/jsonpath without Composer

On this page you can find all versions of the php package loilo/jsonpath. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jsonpath


jsonpath-php

An implementation of RFC 9535 JSONPath

Tests Packagist PHP Version

This is a PHP implementation of JSONPath, a query language for JSON. It aims for 100% compatibilty with the JSONPath syntax standardized in RFC 9535.

Currently, this library passes 99% of the work-in-progress JSONPath Compliance Test Suite (with the test suite version on Feb 21, 2025). All of the the missing 1% are UTF-16 related tests, which should not affect most day-to-day users (and which I'm not sure how to implement in PHP — any help is appreciated!)

Installation

Note that at least PHP 8.0 is needed to use jsonpath-php. For technical reasons, unit tests are only run against PHP 8.2+.

Usage

Development

Project Scope

Please note that I'm striving for feature parity with the jsonpath-js library and therefore will add neither features nor fixes to the search logic that are not reflected in jsonpath-js itself.

If you have any issues with the library that are not obviously bugs in this PHP port, and you happen to know JavaScript, please check if your use case works correctly in the online demo of jsonpath-js since that's the canonical implementation. If the issue appears there as well, please open an issue in their repo.

Setup

To start development on jsonpath-php, you need git, PHP (≥ 8.2), Composer and npm.

Since code is formatted using Prettier, it's also recommended to use an editor which supports Prettier formatting.

Clone the repository and cd into it:

Install Composer dependencies:

Install npm dependencies. They are needed for code formatting and for compiling the Peggy grammar.

Formatting the Code

The code is formatted using Prettier. To format the code, run:

Compiling the Grammar

The JSONPath grammar is defined in src/grammar/rfc9535-parser.pegjs. To compile it to src/PeggyParser.php, run:

Quality Assurance

There are different kinds of code checks in place for this project. All of these are run when a pull request is submitted but can also be run locally:

Command Purpose Description
vendor/bin/phpcs check code style Run PHP_CodeSniffer to verify that the source code abides by the PSR-12 coding style.
vendor/bin/phpstan static analysis Run PHPStan against the codebase to avoid type-related errors and unsafe coding patterns.
vendor/bin/pest check program logic Run all Pest tests from the tests folder.

Credit

All the credit goes to the creator of jsonpath-js. They did all the hard conceptual work, this PHP library is merely a port of their code.


All versions of jsonpath with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package loilo/jsonpath contains the following files

Loading the files please wait ....