cruxoft/dump
Composer 安装命令:
composer require cruxoft/dump
包简介
A system for generating structure information about nested variables for use including screen display
README 文档
README
What is it?
An alternative to var_dump or print_r for generating structure information about variables to then be output.
Installation
Can be installed using composer by running the following:
$ composer require cruxoft/dump
Usage
For details on full basic usage and more complex examples see the examples/ folder.
Output Function
Some simple output based usage examples of the built in dump() function would be as follows:
use function Cruxoft\dump; dump(array("one", "two", 3)); dump(true); dump("Hello World");
Which would output:
array(3):
(
[0] string(3): "one"
[1] string(3): "two"
[2] integer: 3
)
boolean: true
string(11): "Hello World"
The dump method can take an optional options parameter as a bitwise value of the required options. Available options are:
- INCLUDE_LOCATION: Gives the file and line number of the
dumpcall. - RELATIVE_PATHS: Sets paths to be relative to the project root. Requires
CRUXOFT_ROOTconstant to be set. - DIE_AFTER: Calls
die()after thedumpmethod has completed.
use Cruxoft\Dump\Options; use function Cruxoft\dump; dump("Hello World", Options::INCLUDE_LOCATION);
examples/file.php@4
string(11): "Hello World"
Development
Docker
If your local environment does not have an upto date version of PHP installed there is a docker environment is included in the codebase for quickly building a development/testing environment.
Your installed PHP version can be found with the following command:
$ php -v PHP 8.0.7 (cli) (built: Jun 23 2021 12:34:03) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.7, Copyright (c) Zend Technologies
It uses the latest PHP8 FPM image with composer added and can be built and entered:
$ cd docker $ docker-compose -p dump up -d $ docker exec -it dump_php_1 bash
The container can be torn down with:
$ docker-compose stop
Road Map
- Ability to specify formatting parameters for output of dump function
- Additional built-in conversions of structure data (json, xml, etc)
- Coloured output
cruxoft/dump 适用场景与选型建议
cruxoft/dump 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 137 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cruxoft/dump 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cruxoft/dump 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 137
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 9
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-02-15