承接 rcubitto/json-pretty 相关项目开发

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

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

rcubitto/json-pretty

最新稳定版本:1.0

Composer 安装命令:

composer require rcubitto/json-pretty

包简介

Pretty print your PHP arrays with style – in full color and with proper indentation

README 文档

README

Latest Version on Packagist Build Status Quality Score Total Downloads

JSON Pretty is a very simple library that prints a JSON array in full color with proper indentation.

Installation

You can install the package via composer:

composer require rcubitto/json-pretty

Usage

You can print any array, both sequencial and associate.

\Rcubitto\JsonPretty\JsonPretty::print([
    'store' => 'Best Buy',
    'number' => 30305,
    'products' => [
        [
            'name' => 'TV',
            'cost' => 2000.00,
            'in_stock' => true
        ],
        [
            'name' => 'Phone',
            'cost' => 350.80,
            'in_stock' => false
        ],
        [
            'name' => 'Sample',
            'cost' => 0,
            'in_stock' => null
        ]
    ]
]);

The previous snippet will return the following string:

Print output

You can also print an object class:

$obj = new \Stdclass;
$obj->prop = 1;
$obj->another = 2;

\Rcubitto\JsonPretty\JsonPretty::print($obj);

Output:

Print output

NOTE: the string is not echoed out, just returned. So if you want to actually echo it out, don't forget to do so.

Config

You can also configure different colors for different types.

$options = [
    'colors' => [
        'bracket' => 'blue',    // {}[] and object keys
        'number' => 'green',    // any is_numeric (except strings like "1")
        'string' => 'purple',
        'boolean' => 'pink',
        'null' => 'black'
    ]
];


\Rcubitto\JsonPretty\JsonPretty::print($sample, $options);

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please use the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固