vovan-ve/array-dumper
Composer 安装命令:
composer require vovan-ve/array-dumper
包简介
Dumper for constant arrays
README 文档
README
Dumps PHP array into pretty printed PHP code. Only constant data can be dumped,
t.i. data, which can be used in const declaration since PHP 7.
Synopsis
use \VovanVE\array_dumper\ArrayDumper; $dumper = new ArrayDumper(); $data = [ 'foo' => 42, 'bar' => 'string', 'list' => [10, 20, 30], 'hash' => [ 'lorem' => 23, 'ipsum' => true, ], ]; echo $dumper->dump($data);
Output:
[
'foo' => 42,
'bar' => 'string',
'list' => [10, 20, 30],
'hash' => [
'lorem' => 23,
'ipsum' => true,
],
]
Description
Simple array with sequential zero-based integer keys (aka lists) will be dumped in single line, unless the line became too long with indention, or lists nesting level became to deep (both are configurable).
An optional outer indent string can be supplied to dump() method. It is
used internally for nested arrays. It can be anything you want including
comment prefix // .
Notice: The library works only with UTF-8 strings. A string which is not valid
UTF-8 in source data will encode invalid octets with \xFF escape codes. So,
output dump always should be valid UTF-8 code.
Installation
Install through composer:
composer require vovan-ve/array-dumper
or add to require section in your composer.json:
"vovan-ve/array-dumper": "~1.0.0"
License
This package is under MIT License
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-21