{"id":17095435,"url":"https://github.com/estahn/json-query-wrapper","last_synced_at":"2025-04-12T23:22:40.540Z","repository":{"id":3772628,"uuid":"50842755","full_name":"estahn/json-query-wrapper","owner":"estahn","description":"A wrapper for the popular command-line JSON processor \"jq\"","archived":false,"fork":false,"pushed_at":"2024-03-07T16:46:01.000Z","size":62,"stargazers_count":14,"open_issues_count":13,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T17:21:41.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estahn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-01T13:56:20.000Z","updated_at":"2024-03-15T01:23:57.000Z","dependencies_parsed_at":"2023-12-28T03:43:18.050Z","dependency_job_id":null,"html_url":"https://github.com/estahn/json-query-wrapper","commit_stats":{"total_commits":50,"total_committers":6,"mean_commits":8.333333333333334,"dds":0.38,"last_synced_commit":"87bfce4cfd2e50770e5a2ee9b4795a56e3fae1a7"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estahn%2Fjson-query-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estahn%2Fjson-query-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estahn%2Fjson-query-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estahn%2Fjson-query-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estahn","download_url":"https://codeload.github.com/estahn/json-query-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248644213,"owners_count":21138570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T14:42:47.545Z","updated_at":"2025-04-12T23:22:40.508Z","avatar_url":"https://github.com/estahn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Query Wrapper\n\n[![Latest Stable Version](https://poser.pugx.org/estahn/json-query-wrapper/version.png)](https://packagist.org/packages/estahn/json-query-wrapper)\n[![Total Downloads](https://poser.pugx.org/estahn/json-query-wrapper/d/total.png)](https://packagist.org/packages/estahn/json-query-wrapper)\n[![Dependency Status](https://www.versioneye.com/user/projects/56af6f3c3d82b90032bff8d7/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56af6f3c3d82b90032bff8d7)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/727aca9e-cd01-49b7-94f7-a26030ba5639/mini.png)](https://insight.sensiolabs.com/projects/727aca9e-cd01-49b7-94f7-a26030ba5639)\n[![Build Status](https://travis-ci.org/estahn/json-query-wrapper.png?branch=master)](https://travis-ci.org/estahn/json-query-wrapper)\n[![StyleCI](https://styleci.io/repos/50842755/shield)](https://styleci.io/repos/50842755)\n\njson-query-wrapper is a wrapper for the popular command-line JSON processor \"[jq](https://stedolan.github.io/jq/)\".\n\n## Features\n\n* Easy to use interface\n* PHP data type mapping\n\n## Installation\n\n```bash\n$ composer require estahn/json-query-wrapper\n```\n\n## Usage\n### Basic usage\n`test.json`:\n```json\n{\n  \"Foo\": {\n    \"Bar\": \"33\"\n  }\n}\n```\n\n**Example 1:**\n```php\n$jq = JsonQueryWrapper\\JsonQueryFactory::createWith('test.json');\n$jq-\u003erun('.Foo.Bar'); # string(33)\n```\n\n**Example 2:**\n```php\n$jq = JsonQueryWrapper\\JsonQueryFactory::createWith('test.json');\n$jq-\u003erun('.Foo.Bar == \"33\"'); # Returns bool(true)\n```\n\n**Example 3:**\n```php\n$jq = JsonQueryWrapper\\JsonQueryFactory::createWith('{\"Foo\":{\"Bar\":\"33\"}}');\n$jq-\u003erun('.Foo.Bar == \"33\"'); # Returns bool(true)\n```\n\n### Advanced usage\n\n**Example 1:**\n```php\n$jq = JsonQueryWrapper\\JsonQueryFactory::create();\n$jq-\u003esetDataProvider(new JsonQueryWrapper\\DataProvider\\File('test.json');\n$jq-\u003erun('.Foo.Bar == \"33\"'); # Returns bool(true)\n```\n\n## Data Providers\n\nA \"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`.\n\nAvailable providers:\n\n* `Text` - Regular PHP string containing JSON data\n* `File` - A path to a file containing JSON data\n\n## Badge Mania\n[![Build Status](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/badges/build.png?b=master)](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/build-status/master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/estahn/json-query-wrapper/?branch=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/grade/95079dc568414f938388af783c9a6672)](https://www.codacy.com/app/estahn/json-query-wrapper)\n[![Codacy Badge](https://api.codacy.com/project/badge/coverage/95079dc568414f938388af783c9a6672)](https://www.codacy.com/app/Codacy/php-codacy-coverage)\n\n\n## Alternatives\n\n* [jmespath.php](https://github.com/jmespath/jmespath.php) - Declaratively specify how to extract elements from a JSON document, in PHP\n* [JSONPath](https://github.com/FlowCommunications/JSONPath) - JSONPath implementation for PHP (based on Stefan Goessner's JSONPath script)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festahn%2Fjson-query-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festahn%2Fjson-query-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festahn%2Fjson-query-wrapper/lists"}