PHPackages                             estahn/json-query-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. estahn/json-query-wrapper

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

estahn/json-query-wrapper
=========================

Wrapper for jq, a lightweight and flexible command-line JSON processor

v1.0.0(5y ago)1554.3k↓39.4%4[1 issues](https://github.com/estahn/json-query-wrapper/issues)[12 PRs](https://github.com/estahn/json-query-wrapper/pulls)1MITPHPPHP ^7.1|^8CI failing

Since Feb 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/estahn/json-query-wrapper)[ Packagist](https://packagist.org/packages/estahn/json-query-wrapper)[ Docs](https://github.com/estahn/json-query-wrapper)[ RSS](/packages/estahn-json-query-wrapper/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (3)Versions (17)Used By (1)

JSON Query Wrapper
==================

[](#json-query-wrapper)

[![Latest Stable Version](https://camo.githubusercontent.com/4f0f2cf75dfb3ac2865139e4e40bbd78eb62aaa2f572bc212cb7aaf9a2b471ef/68747470733a2f2f706f7365722e707567782e6f72672f65737461686e2f6a736f6e2d71756572792d777261707065722f76657273696f6e2e706e67)](https://packagist.org/packages/estahn/json-query-wrapper)[![Total Downloads](https://camo.githubusercontent.com/3efe425332f3c8a2554c46d939ac00f799b820c73905df7597d9b070f369f3f3/68747470733a2f2f706f7365722e707567782e6f72672f65737461686e2f6a736f6e2d71756572792d777261707065722f642f746f74616c2e706e67)](https://packagist.org/packages/estahn/json-query-wrapper)[![Dependency Status](https://camo.githubusercontent.com/010ead173feda4026668b2471a99ebe336328373252f4490dc56c6916273a57c/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3536616636663363336438326239303033326266663864372f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/56af6f3c3d82b90032bff8d7)[![SensioLabsInsight](https://camo.githubusercontent.com/9e3009ce46e032b2cd1d6f2442243899124f50b0f4688c62db4ce2bc256662fb/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f37323761636139652d636430312d343962372d393466372d6132363033306261353633392f6d696e692e706e67)](https://insight.sensiolabs.com/projects/727aca9e-cd01-49b7-94f7-a26030ba5639)[![Build Status](https://camo.githubusercontent.com/ed21f2c80d1cc8d9ab122f832c2330ae62d1ad940ebc87cd217298a3d13fb919/68747470733a2f2f7472617669732d63692e6f72672f65737461686e2f6a736f6e2d71756572792d777261707065722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/estahn/json-query-wrapper)[![StyleCI](https://camo.githubusercontent.com/0e99eeeb3e7c25fd7fa46f9eb527e655e16d28954dc7c855b8905178a7bb4480/68747470733a2f2f7374796c6563692e696f2f7265706f732f35303834323735352f736869656c64)](https://styleci.io/repos/50842755)

json-query-wrapper is a wrapper for the popular command-line JSON processor "[jq](https://stedolan.github.io/jq/)".

Features
--------

[](#features)

- Easy to use interface
- PHP data type mapping

Installation
------------

[](#installation)

```
$ composer require estahn/json-query-wrapper
```

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

`test.json`:

```
{
  "Foo": {
    "Bar": "33"
  }
}
```

**Example 1:**

```
$jq = JsonQueryWrapper\JsonQueryFactory::createWith('test.json');
$jq->run('.Foo.Bar'); # string(33)
```

**Example 2:**

```
$jq = JsonQueryWrapper\JsonQueryFactory::createWith('test.json');
$jq->run('.Foo.Bar == "33"'); # Returns bool(true)
```

**Example 3:**

```
$jq = JsonQueryWrapper\JsonQueryFactory::createWith('{"Foo":{"Bar":"33"}}');
$jq->run('.Foo.Bar == "33"'); # Returns bool(true)
```

### Advanced usage

[](#advanced-usage)

**Example 1:**

```
$jq = JsonQueryWrapper\JsonQueryFactory::create();
$jq->setDataProvider(new JsonQueryWrapper\DataProvider\File('test.json');
$jq->run('.Foo.Bar == "33"'); # Returns bool(true)
```

Data Providers
--------------

[](#data-providers)

A "Data Provider" provides the wrapper with the necessary data to read from. It's a common interface for several providers. All providers implement the `DataProviderInterface` which essentially returns a path to the file for `jq`.

Available providers:

- `Text` - Regular PHP string containing JSON data
- `File` - A path to a file containing JSON data

Badge Mania
-----------

[](#badge-mania)

[![Build Status](https://camo.githubusercontent.com/576416aa7233073d2ec32accc1116320313cf171fa2a4aa4e6b075a9a53a1439/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65737461686e2f6a736f6e2d71756572792d777261707065722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/261059063fff80a9950dc9176626b8fb37b48e40d739d7e1eb9ff41bda7ed675/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65737461686e2f6a736f6e2d71756572792d777261707065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/2e34e54492f762ffebcadad147c1510f4a35a6f94d9de7c53a0a425eb7ffe943/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65737461686e2f6a736f6e2d71756572792d777261707065722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/3265b9786d8c9127d54a14224bcb8a71ca4b1fbbf2146112c0b99956cc0bed9f/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f67726164652f3935303739646335363834313466393338333838616637383363396136363732)](https://www.codacy.com/app/estahn/json-query-wrapper)[![Codacy Badge](https://camo.githubusercontent.com/66766cab850775c25359db06bcffdac021509537d0db2191d38d049c8c68b5e5/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f636f7665726167652f3935303739646335363834313466393338333838616637383363396136363732)](https://www.codacy.com/app/Codacy/php-codacy-coverage)

Alternatives
------------

[](#alternatives)

- [jmespath.php](https://github.com/jmespath/jmespath.php) - Declaratively specify how to extract elements from a JSON document, in PHP
- [JSONPath](https://github.com/FlowCommunications/JSONPath) - JSONPath implementation for PHP (based on Stefan Goessner's JSONPath script)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 89.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~361 days

Recently: every ~451 days

Total

6

Last Release

1998d ago

Major Versions

v0.2.1 → v1.0.02021-01-11

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.0

v1.0.0PHP ^7.1|^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/88db7e9f484cfb999a57b2571d0940c292955c1b14c8ca137fe4d5b8a348983c?d=identicon)[estahn](/maintainers/estahn)

---

Top Contributors

[![estahn](https://avatars.githubusercontent.com/u/362174?v=4)](https://github.com/estahn "estahn (53 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (3 commits)")[![javiercejudo](https://avatars.githubusercontent.com/u/1095851?v=4)](https://github.com/javiercejudo "javiercejudo (1 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (1 commits)")[![SunMar](https://avatars.githubusercontent.com/u/8324268?v=4)](https://github.com/SunMar "SunMar (1 commits)")

---

Tags

jsonqueryjq

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/estahn-json-query-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/estahn-json-query-wrapper/health.svg)](https://phpackages.com/packages/estahn-json-query-wrapper)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[nahid/jsonq

JsonQ is a PHP based json data query library

873672.6k7](/packages/nahid-jsonq)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[ergebnis/json-printer

Provides a JSON printer, allowing for flexible indentation.

9242.4M29](/packages/ergebnis-json-printer)[phptek/jsontext

JSON storage, querying and modification.

2222.2k2](/packages/phptek-jsontext)[dagger/dagger

Dagger PHP SDK

261.1k](/packages/dagger-dagger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
