承接 estahn/json-query-wrapper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

estahn/json-query-wrapper

最新稳定版本:v1.0.0

Composer 安装命令:

composer require estahn/json-query-wrapper

包简介

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

README 文档

README

Latest Stable Version Total Downloads Dependency Status SensioLabsInsight Build Status StyleCI

json-query-wrapper is a wrapper for the popular command-line JSON processor "jq".

Features

  • Easy to use interface
  • PHP data type mapping

Installation

$ composer require estahn/json-query-wrapper

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

Example 1:

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

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

Build Status Scrutinizer Code Quality Code Coverage Codacy Badge Codacy Badge

Alternatives

  • jmespath.php - Declaratively specify how to extract elements from a JSON document, in PHP
  • JSONPath - JSONPath implementation for PHP (based on Stefan Goessner's JSONPath script)

统计信息

  • 总下载量: 44.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-01