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.
qafoo/ser-pretty 适用场景与选型建议
qafoo/ser-pretty 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 159k 次下载、GitHub Stars 达 40, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 qafoo/ser-pretty 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 qafoo/ser-pretty 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 159k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 40
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知