Laravel Tracy 1.8.5 版

Donate

Nette Tracy for Laravel 5

Better Laravel Exception Handler

StyleCI
Build Status
Total Downloads
Latest Stable Version
Latest Unstable Version
License
Monthly Downloads
Daily Downloads
Scrutinizer Code Quality
Code Coverage

Laravel Tracy

Features

  • Visualization of errors and exceptions
  • Debugger Bar (ajax support @v1.5.6)
  • Exception stack trace contains values of all method arguments.

Online Demo

Demo

Installing

To get the latest version of Laravel Exceptions, simply require the project using Composer:

composer require recca0120/laravel-tracy

Instead, you may of course manually update your require block and run composer update if you so choose:

{
    "require": {
        "recca0120/laravel-tracy": "^1.7.13"
    }
}

Include the service provider within config/app.php. The service povider is needed for the generator artisan command.

'providers' => [
    ...
    Recca0120\LaravelTracy\LaravelTracyServiceProvider::class,
    ...
];

publish

php artisan vendor:publish --provider="Recca0120\LaravelTracy\LaravelTracyServiceProvider"

Config

return [
    'enabled' => env('APP_DEBUG') === true,
    'showBar' => env('APP_ENV') !== 'production',
    'accepts'      => [
        'text/html',
    ],
    // appendTo: body | html
    'appendTo' => 'body',
    'editor' => 'subl://open?url=file://%file&line=%line',
    'maxDepth' => 4,
    'maxLength' => 1000,
    'scream' => true,
    'showLocation' => true,
    'strictMode' => true,
    'panels' => [
        'routing' => true,
        'database' => true,
        'view' => true,
        'event' => false,
        'session' => true,
        'request' => true,
        'auth' => true,
        'html-validator' => true,
        'terminal' => true,
    ],
];

Editor Link

windows

copy <vendor path>/recca0120/laravel-tracy/tools/subl-handler/subl-handler.vbs to any directory where you want to place

double click subl-handler.vbs and select editor (support eclipse, sublime, notepad++, else...)

OSX

https://github.com/dhoulb/subl

Prefer PhpStorm, you can edit config/tracy.php's key of editor like this:

'editor' => 'phpstorm://open?file=%file&line=%line',

Debugger Bar

Directive bdump

Ajax

Ajax Debugger Bar

Ajax

SystemInfo

SystemInfo

Route

Route

View

View

Session

Session

Request

Request

Auth

Auth

Custom Auth

// app/Providers/AppServiceProvider.php

namespace App\Providers;

use Recca0120\LaravelTracy\BarManager;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function boot(BarManager $barManager)
    {
        $barManager->get('auth')->setUserResolver(function() {
            return [
                'id' => 'xxx',
                'username' => 'xxx',
                ...
            ];
        });
    }
}

Html Validator

Html Validator

Web Artisan

web artisan is another package recca0120/terminal
Terminal

notice

if you install terminal before, this panel will throw errors, please remove folder app/resources/views/vendor/terminal

STANDALONE

require __DIR__.'/../vendor/autoload.php';

use Recca0120\LaravelTracy\Tracy;

// before outout
$tracy = Tracy::instance();

$authPanel = $tracy->getPanel('auth');
$authPanel->setUserResolver(function() {
    return [
        'email' => 'recca0120@gmail.com'
    ];
});

function sql($sql)
{
    $tracy = Tracy::instance();
    $databasePanel = $tracy->getPanel('database');
    $databasePanel->logQuery($sql);
}

sql('select * from users');
sql('select * from news');
sql('select * from products');

Standalone

Thanks

本帖已被设为精华帖!
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 19

下個版本加入使用 console.log來顯示sql

這樣就能留在sql了

8年前 评论

挺好的,ajax问题 1.5.6 好像还有。

8年前 评论

@akphp 什麼樣的問題?
提示一下!

8年前 评论

@recca0120 我用的 datatables , sql里都没有,是我使用不对吗。
配置是默认的

8年前 评论

@akphp

這個問題在剛剛修復了...

1.5.8版被我改壞了,所以Ajax的部份全部失效

試看看1.5.9版,ajax就能正常顯示了

8年前 评论

@nickfan

不好意思剛剛才看懂你的問題,參考以下連結..

atom

osx: https://github.com/WizardOfOgz/atom-handle...

windows: https://github.com/recca0120/laravel-tracy...

8年前 评论

@recca0120 太好了,我去试试,谢谢

8年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!