转载请注明: 转载自Yuansir-web菜鸟 | LAMP学习笔记php
本文连接地址: 实用的Laravel Debug调试工具laravel
主要推荐laravel几个适合开发调试用的工具git
1.Clockworkgithub
首先Chrome 插件 Clockwork
安装 Composer Package, composer.json 中添加 “itsgoingd/clockwork”: “1.*”,composer update
app/config/app.php 配置文件中添加:web
'providers' => array( ... 'Clockwork\Support\Laravel\ClockworkServiceProvider' )
在你的Base Controller 中的构造方法中添加以下代码:chrome
public function __construct() { if (app()->env == 'local') { $this->beforeFilter( function () { Event::fire('clockwork.controller.start'); } ); $this->afterFilter( function () { Event::fire('clockwork.controller.end'); } ); } }
再chrome的控制台会看到以下信息:json
Clockwork还提供了其余一些有用的log相关函数,具体配置使用请看github文档.https://github.com/itsgoingd/clockworkapp
2.anbu
配置方法和Clockwork相似,可是不须要Chrome 插件,效果以下:composer
具体配置和使用方法请参见github文档.https://github.com/daylerees/anbuyii
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调试工具