您的位置:首页 > 编程语言 > PHP开发

实用的Laravel Debug调试工具

2015-01-19 19:01 811 查看
摘要: 主要推荐laravel几个适合开发调试用的工具

转载请注明: 转载自Yuansir-web菜鸟 | LAMP学习笔记
本文链接地址: 实用的Laravel Debug调试工具
主要推荐laravel几个适合开发调试用的工具
1.Clockwork
首先Chrome 插件 Clockwork
安装 Composer Package, composer.json 中添加 “itsgoingd/clockwork”: “1.*”,composer update
app/config/app.php 配置文件中添加:



'providers' => array(
...
'Clockwork\Support\Laravel\ClockworkServiceProvider'
)

在你的Base Controller 中的构造方法中添加如下代码:
public function __construct()
{
if (app()->env == 'local') {
$this->beforeFilter(
function () {
Event::fire('clockwork.controller.start');
}
);

$this->afterFilter(
function () {
Event::fire('clockwork.controller.end');
}
);
}
}

再chrome的控制台会看到如下信息:
Clockwork还提供了其他一些有用的log相关函数,具体配置使用请看github文档.https://github.com/itsgoingd/clockwork

2.anbu
配置方法和Clockwork类似,但是不需要Chrome 插件,效果如下:



具体配置和使用方法请参见github文档.https://github.com/daylerees/anbu
3.laravel-debugbar
名字就看出来是laravel的一个debug工具bar,安装配置和前两者类似,效果如下:



这个工具栏很强大,但是我不喜欢用,它会拖慢页面加载,支持的方法很多,比如:
Debugbar::info($object);
Debugbar::error('Error!');
Debugbar::warning('Watch out…');
Debugbar::addMessage('Another message', 'mylabel');

Debugbar::startMeasure('render','Time for rendering');
Debugbar::stopMeasure('render');
Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
Debugbar::measure('My long operation', function() {
// Do something…
});

具体配置使用请参见github文档.https://github.com/barryvdh/laravel-debugbar
转载请注明: 转载自Yuansir-web菜鸟 | LAMP学习笔记
本文链接地址: 实用的Laravel Debug调试工具

相关文章

理解PHP 依赖注入|Laravel IoC容器

Yii Zii组件 CGridView 使用详解

Yii中实现插件机制

让Yii表单生成器不依赖Model

Laravel 创建 Facades 实例
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Laravel