regulus/exterminator
Composer 安装命令:
composer require regulus/exterminator
包简介
A simple debugging composer package for Laravel 4 that allows you to output color-coded variable dumps on the screen depending on whether a 'debug' cookie is present.
README 文档
README
A simple debugging composer package for Laravel 4 that allows you to output color-coded variable dumps on the screen depending on whether a 'debug' cookie is present.
Variable dumps are color-coded and just as descriptive as PHP's var_dump() method. You may hide the Exterminator window by clicking the "Hide" button and may single-click on any variable to select it in its entirety. These things help to make Exterminator much nicer to work with than just a crude var_dump.
Using the Dbg::display() method, you can dump all of your variables at the end of your view to prevent any data output from breaking your rendered HTML page. They variable output is also contained in HTML markup and use various Javascript methods for enhanced use as described above.
Installation
To install Exterminator, make sure "regulus/exterminator" has been added to Laravel 4's composer.json file.
"require": {
"regulus/exterminator": "dev-master"
},
Then run php composer.phar update from the command line. Composer will install the Exterminator package. Now, all you have to do is register the service provider and set up Exterminator's alias in app/config/app.php. Add this to the providers array:
'Regulus\Exterminator\ExterminatorServiceProvider',
And add this to the aliases array:
'Dbg' => 'Regulus\Exterminator\Exterminator',
You may use 'Exterminator', 'Debug', or another alias, but 'Dbg' is recommended for the sake of simplicity. Exterminator is now ready to go.
Enabling Exterminator
To enable Exterminator, navigate to http://site.com/debug/debug1913. This will enable the viewing of Exterminator's data output by placing a cookie on your machine. Note that the debug1913 part is your Exterminator access code and can be configured in config.php.
Usage
Basic usage:
To display a variable after you have set your debug cookie:
$var = array(
'boolean' => true,
'number' => 3.43,
'string' => 'Testing Exterminator',
'array' => array(
'boolean' => false,
'number' => 5,
'object' => (object) array(
'Number One',
2,
3.0,
),
),
);
Dbg::display($var);
Displaying multiple variables:
To display multiple variables, use Exterminator's "add" method, Dbg::a():
Dbg::a($var);
Dbg::a($var2);
Then at in the footer of your website add a simple Dbg::display() with no arguments:
<?php Dbg::display(); ?>
</body>
</html>
Adding variable names to dumped variables:
You can get the variable names to show up in the upper-right area of an outputted variable using PHP's get_defined_vars(). Please note that this may not work in all cases. Here is how to do it:
$definedVars = get_defined_vars();
Dbg::a($var, $definedVars);
Dbg::a($var2, $definedVars);
You can also set the variable name manually by passing a string as the second argument:
Dbg::a($var, 'var');
regulus/exterminator 适用场景与选型建议
regulus/exterminator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 114 次下载、GitHub Stars 达 0, 最近一次更新时间为 2013 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 regulus/exterminator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 regulus/exterminator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 114
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 42
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-23