实用的Laravel Debug调试工具

转载请注明: 转载自Yuansir-web菜鸟 | LAMP学习笔记

本文链接地址: 实用的Laravel Debug调试工具

主要推荐laravel几个适合开发调试用的工具

1.Clockwork

首先Chrome 插件 Clockwork
安装 Composer Package, composer.json 中添加 “itsgoingd/clockwork”: “1.*”,composer update
app/config/app.php 配置文件中添加:

Laravel Debuger

'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 插件,效果如下:

Laravel Debuger

具体配置和使用方法请参见github文档.https://github.com/daylerees/anbu

3.laravel-debugbar
名字就看出来是laravel的一个debug工具bar,安装配置和前两者类似,效果如下:

Laravel Debuger

这个工具栏很强大,但是我不喜欢用,它会拖慢页面加载,支持的方法很多,比如:

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调试工具

相关文章


转载于:https://my.oschina.net/yuansir/blog/369417

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值