qafoo/ser-pretty
Composer 安装命令:
composer require qafoo/ser-pretty
包简介
Pretty print serialized PHP data
README 文档
README
ser-pretty prints serialized PHP in the style of var_dump() without
sourcing the required classes.
$ src/bin/ser-pretty test.txt
class stdClass (1) {
private $bar =>
int(223)
}
Download ser-pretty as a PHAR
or require qafoo/ser-pretty via composer.
But, why?
It happens often that you have serialized PHP data lying around, e.g. from caching, session data or transmitting it through a queue. If you want to inspect this data for debugging purposes you typically write a tiny script that loads your classes (which are needed for de-serialization), get the data and display a var dump.
ser-pretty deprecates the script-step by simply rendering a var_dump() outut
from serialized data, without needing to source the class source.
The CLI
ser-pretty comes with a very simple PHP CLI script, that reads serialized data from STDIN or a given file and prints the formatted output to STDOUT. Just call:
$ ser-pretty.phar dumped_data.txt
This even works for Doctrine annotation cache files since ser-pretty 0.2.0.
You can also pipe serialized data from another script to it:
$ some_script.php | ser-pretty.phar
The Lib
You can also use ser-pretty as a library to integrate pretty printing of serialized PHP data into your debugging/monitoring/… tools. Just look into the CLI script to see what it does.
- The
Parserparses serialized into a very simple AST - A
Writerturns an AST into a string representation
ser-pretty ships with a var_dump() style writer, the SimpleTextWriter which
you can use out of the box. You can implement your own writer by deriving the
Writer class.
Installation
Just include ser-pretty in your project via composer using or download the latest PHAR.
统计信息
- 总下载量: 159.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 40
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-19