定制 deftek/json_pp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

deftek/json_pp

Composer 安装命令:

composer require deftek/json_pp

包简介

JSON Pretty Printer

README 文档

README

The json_pp utility prints JSON data in a legible, indented format. It provides the most benefit to people who need to read, inspect, and understand JSON data structures that are not already provided with separating white space, such as software developers building or consuming JSON-based APIs.

By default, json_pp does not escape slashes or multi-byte Unicode characters. These characters may be escaped by overriding the default encode options with a configuration file. Pretty-printing may be similarly disabled when compact JSON is needed and the source JSON is already formatted with white space.

System Requirements

  • PHP 5.5.0 or later must be available at the command line in order to run json_pp. Users of older versions of PHP should seriously consider upgrading. PHP 7 or later is required to run the test suite.
  • Composer is used for automating installation, and it is also possible to manually download and install this package.

Installation

To make json_pp available to all system users, which may require system administrator (e.g., root) privileges:

composer global install deftek/json_pp

To make json_pp available only for the current system user:

composer install deftek/json_pp

To include json_pp in a project that uses Composer:

composer require deftek/json_pp

To include json_pp for development purposes in a project that uses Composer:

composer require --dev deftek/json_pp

Usage

Pretty-print compact JSON contained in a string

echo '{"foo":{"bar":"baz"}}' | json_pp

Output:

{
    "foo": {
        "bar": "baz"
    }
}

Pretty-print compact JSON contained in a file:

json_pp < compact.json

Output compact JSON from pretty-printed source:

echo pretty.json | json_pp --config=config.compact.php

Where config.compact.php contains something like:

<?php
return [
    'decode' => 0,
    'depth'  => 512,
    'encode' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE,
];

Configuration

See config.default.php for the default configuration values, and override the values in your own configuration files as needed.

The configuration file contains three options that are used for controlling arguments to the json_decode() and json_encode() function calls:

  1. decode: This value represents the options argument for json_decode().
  2. depth: This value represents the depth argument for both json_decode() and json_encode().
  3. encode: This value represents the options argument for json_encode().

Copyright and License

The json_pp package is provided under the 3-Clause (aka New or Modified) BSD License. Complete copyright and license information is available in LICENSE.txt.

Issues and Contributing

Issues may be reported and contributions may be accepted within the contribution guidelines.

Change Log

Notable changes to json_pp are documented in the change log.

deftek/json_pp 适用场景与选型建议

deftek/json_pp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 263 次下载、GitHub Stars 达 38, 最近一次更新时间为 2017 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 deftek/json_pp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 deftek/json_pp 我们能提供哪些服务?
定制开发 / 二次开发

基于 deftek/json_pp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 263
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 38
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 38
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-07-15