A Laravel Package to integrate Nette Tracy Debugger

Last update: May 3, 2022

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 --dev

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

{
    "require-dev": {
        "recca0120/laravel-tracy": "^1.8.14"
    }
}

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"

if you see Route [tracy.bar] not defined. pleace run artisan route:clear once

artisan route:clear

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,
        'model' => 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...)

If you use Vagrant and have issues with the incorrect path being called, you can create a symlink as illustrated at: https://prnt.sc/lpswki

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' => '[email protected]'
    ];
});

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

GitHub

https://github.com/recca0120/laravel-tracy
Comments
  • 1. v1.0.19 not compatible with PHP 5.4

    ~/Sites/laraveldemo (develop *+)$ php artisan serve
    Laravel development server started on http://localhost:8000/
    [Sun Sep 11 17:18:34 2016] PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /Users/allen/Sites/laraveldemo/vendor/recca0120/laravel-tracy/src/Panels/AbstractPanel.php on line 71
    [Sun Sep 11 17:18:34 2016] PHP Fatal error:  Call to undefined method Recca0120\LaravelTracy\Exceptions\Handler::toIlluminateResponse() in /Users/allen/Sites/laraveldemo/vendor/recca0120/laravel-tracy/src/Exceptions/Handler.php on line 46
    
    ~/Sites/laraveldemo (develop *+)$ php artisan -V
    Laravel Framework version 5.0.35
    
    ~/Sites/laraveldemo (develop *+)$ php -v
    PHP 5.4.45 (cli) (built: Jul 28 2016 16:05:43)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    ~/Sites/laraveldemo (develop *+)$
    
    ~/Sites/laraveldemo (develop *+)$ cat composer.json
    {
            "name": "laravel/laravel",
            "description": "The Laravel Framework.",
            "keywords": ["framework", "laravel"],
            "license": "MIT",
            "type": "project",
            "require": {
                "laravel/framework": "5.0.*",
                "recca0120/laravel-tracy": "1.0.*"
            },
            "require-dev": {
                "phpunit/phpunit": "~4.0",
                "phpspec/phpspec": "~2.1"
            },
            "autoload": {
                "classmap": [
                    "database"
                ],
                "psr-4": {
                    "App\\": "app/"
                }
            },
            "autoload-dev": {
                "classmap": [
                    "tests/TestCase.php"
                ]
            },
            "scripts": {
                "post-install-cmd": [
                    "php artisan clear-compiled",
                    "php artisan optimize"
                ],
                "post-update-cmd": [
                    "php artisan clear-compiled",
                    "php artisan optimize"
                ],
                "post-create-project-cmd": [
                    "php -r \"copy('.env.example', '.env');\"",
                    "php artisan key:generate"
                ]
            },
            "config": {
                "preferred-install": "dist"
            }
    }
    
    Reviewed by bestlong at 2016-09-11 09:27
  • 2. 請問關於使用sentinel auth套件 在AuthPanel

    Hi 我使用 sentinel 作為登入功能 可是在 AuthPanel 沒有顯示相關對應的登入資料

    我試著在 /vendor/recca0120/laravel-tracy/src/Panels/AuthPanel.php @loadUser 修改了取得資訊的方式可以顯示, 但是這樣直接改了 vendor內的東西, 如果有更新版本, 就會被蓋掉, 請教是否有建議的方法呢 ?

    Reviewed by imagine10255 at 2017-02-14 16:40
  • 3. Tracy dump() and barDump() methods don't print the desired variables

    Hi, the title is obvious but still - neither of these var dump static methods work for me.

    This code

    Debugger::barDump('foo');
    Debugger::dump('bar');
    

    prints exactly nothing. In Nette, it works well.

    Are you planning support of these essentials methods? :) Thanks.

    Reviewed by TeeJay-net at 2016-07-11 11:49
  • 4. Tracy Handler.php render method checks if response->getContent instance of View, but is string so never returns view.

    In Laravel 5.4, if in my exception handler I add some code like:

    return response()->view('errors.403', [], 403); And have Tracy running, tracy will never show the view response and instead shows the full exception trace, this is because in: vendor/recca0120/laravel-tracy/src/Exceptions/Handler.php Line 62, we check $response->getContent instanceof View, however at this point the getContent returns the compiled view string, and it's the original property on the response that holds the view instance.

    We could add an additional || to the if to account for $response->getOriginalContent() instanceof View (Looking at the commit history of the Response class in Laravel, when setting content it always rendered the view object into a string so it may be this never worked and we should either be checking is_string or checking the originalContent?)

    Reviewed by jrbarnard at 2017-07-18 08:09
  • 5. Tracy killing session flash message

    We have a sessionTimeout middleware that logs a person out if the session expires and redirects them to the login page with a flash message. We do this in case session expires and the user attempts an ajax search.

    When debug is set to true and Tracy is active, we lose the session flash message. When set to false, the flash message makes it through. I am wondering if Tracy is grabbing the session data and not reflashing it somehow?

    We are on Laravel 5.4 and Tracy 1.8.5.

    Reviewed by ApeWare at 2017-06-08 16:23
  • 6. 1.8.23 在 Laravel 5.8 無法處理 AJAX 請求

    在 AJAX 請求回傳後 會緊接著一個送往 /tracy/bar?_tracy_bar=content-ajax... 的請求,用於取得要顯示在 bar 的內容 但在 Laravel 5.8 使用時 第二個請求不是送往 /tracy/bar,而是錯誤地送往當前頁面的路由

    這會導致出現以下錯誤,而無法在 bar 顯示 AJAX 的請求

    Uncaught SyntaxError: Unexpected token <
    

    image

    Reviewed by jyhsu2000 at 2019-06-09 07:30
  • 7. 500 internal server error when ?_tracy_bar=assets in the URL

    I get an error and tracy will not show, when accessing URL with the _tracy_bar=assets param.

    Laravel version 5.3.18, this plugin at 1.7.8

    There is no more what can I say, it's somewhere deeper: http://prntscr.com/cx138b

    htaccess:

    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>
    
        RewriteEngine On
    
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)/$ /$1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    
        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    </IfModule>
    

    Do you know where could a problem be?

    Thank you.

    Jakub

    Reviewed by jakubkratina at 2016-10-21 09:27
  • 8. Tracy debug config not working

    目前我是改tracy.php

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

    但是跑出來的連結是'editor:// 我去改Debgger.php line95 public static $editor = 'editor://open/?file=%file&line=%line'; 才會連到我的IDE 其他的config 不太清楚有沒有影響

    Reviewed by magussiro at 2016-10-11 10:05
  • 9. How to disable on local env ?

    Hi, I really like Tracy, thanks for porting it to laravel !

    I tried below code in base controller and even in Exceptions/Handler.php to disable tracy if app is running in local mode:

    if (!App::environment('local')) {
        Config::set('tracy.enabled', false);
    }
    

    However it didn't work.

    Do you plan to add some localOnly option in package's config file ? Or how do I disable this on local for now ?

    Reviewed by sarfraznawaz2005 at 2016-09-17 19:16
  • 10. Error in Auth showing at AJAX bar

    When there are AJAX events occur, the AJAX bar will appear. However, the "User" attribute of the AJAX bar shows "Error in Auth". I have clicked it and it throws the exceptions inside the modal window.

    fireshot screen capture 001 - i i - littpi_cool_admin_user_group

    Reviewed by littpi at 2018-03-26 07:20
  • 11. How do set an email address for alerts in the config

    Normally with tracy i set it up like this

    Debugger::enable(Debugger::DETECT, 'logs/tracy', '[email protected]'); Debugger::getLogger()->emailSnooze = 30;

    How can I configure those settings in the config.php?

    Reviewed by ghost at 2017-02-25 00:47
  • 12. Where is the best place to automatically/globally log all queries?

    I've tried doing it in a listener in my AppServiceProvider like:

    class AppServiceProvider extends ServiceProvider
    {
        public function boot(){
            $config = $this->app['config']['tracy'];
            $enabled = Arr::get($config, 'enabled', true) === true;
            if ($enabled === true) {
                /** @var QueryExecuted $query */
                DB::listen(function ($query) {
                    $tracy = Tracy::instance();
                    $databasePanel = $tracy->getPanel('database');
                    /** @var DatabasePanel $databasePanel */
                    $databasePanel->logQuery($query->sql, $query->bindings, $query->time);
                });
            }
        }
    }
    

    Unfortunately, your super neat findSource function just points me back to my index.php if I do this. Thank you so much! :D

    Reviewed by mikepsinn at 2018-12-06 03:24
🔴 First class integration of Sentry to Nette Framework (@nette)
🔴 First class integration of Sentry to Nette Framework (@nette)

Website ?? contributte.org | Contact ????‍?? f3l1x.io | Twitter ?? @contributte Usage To install latest version of contributte/sentry use Composer. co

Jan 27, 2022
😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.
😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

Tracy - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo

May 20, 2022
Xdebug — Step Debugger and Debugging Aid for PHP

Xdebug Xdebug is a debugging tool for PHP. It provides step-debugging and a whole range of development aids, such as stack traces, a code profiler, fe

May 13, 2022
The Interactive PHP Debugger

The interactive PHP debugger Implemented as a SAPI module, phpdbg can exert complete control over the environment without impacting the functionality

Apr 26, 2022
Dontbug is a reverse debugger for PHP
Dontbug is a reverse debugger for PHP

Dontbug Debugger Dontbug is a reverse debugger (aka time travel debugger) for PHP. It allows you to record the execution of PHP scripts (in command li

May 8, 2022
Php Debugger to run in terminal to debug your code easily.
Php Debugger to run in terminal to debug your code easily.

What is Dephpugger? Dephpugger (read depugger) is an open source lib to make a debug in php direct in terminal, without necessary configure an IDE. Th

Jan 12, 2022
Yet Another Swoole Debugger
Yet Another Swoole Debugger

English | 中文 yasd Yet Another Swoole Debugger. document How to use it build You'll need to install the Boost library first. macOS: brew install boost

May 16, 2022
Php Debugger to run in terminal to debug your code easily.
Php Debugger to run in terminal to debug your code easily.

What is Dephpugger? Dephpugger (read depugger) is an open source library that allows a developer to debug in php direct in terminal, without necessary

May 20, 2022
This package connects a Laravel Octance application with Tideways for PHP Monitoring, Profiling and Exception Tracking.

Tideways Middleware for Laravel Octane This package connects a Laravel Octance application with Tideways for PHP Monitoring, Profiling and Exception T

Jan 6, 2022
Laravel Dumper - Improve the default output of dump() and dd() in Laravel projects

Laravel Dumper Improve the default output of dump() and dd() in Laravel projects. Improves the default dump behavior for many core Laravel objects, in

May 12, 2022
Generate Laravel test factories from your existing models

Laravel Test Factory Generator php artisan generate:model-factory This package will generate factories from your existing models so you can get starte

May 15, 2022
Laravel Debugbar (Integrates PHP Debug Bar)
Laravel Debugbar (Integrates PHP Debug Bar)

Laravel Debugbar This is a package to integrate PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to th

May 24, 2022
A beautiful error page for Laravel apps
A beautiful error page for Laravel apps

Ignition: a beautiful error page for Laravel apps Ignition is a beautiful and customizable error page for Laravel applications running on Laravel 5.5

May 13, 2022
:dromedary_camel: Laravel log viewer
:dromedary_camel: Laravel log viewer

Laravel log viewer TL;DR Log Viewer for Laravel 5, 6, 7 & 8 (still compatible with 4.2 too) and Lumen. Install with composer, create a route to LogVie

May 24, 2022
:page_with_curl: Provides a log viewer for Laravel
:page_with_curl: Provides a log viewer for Laravel

LogViewer By ARCANEDEV© This package allows you to manage and keep track of each one of your log files. NOTE: You can also use LogViewer as an API. Of

May 13, 2022
An elegant debug assistant for the Laravel framework.
An elegant debug assistant for the Laravel framework.

Introduction Laravel Telescope is an elegant debug assistant for the Laravel framework. Telescope provides insight into the requests coming into your

May 19, 2022
Ray server is a beautiful, lightweight php app build on Laravel that helps you debug your app. It runs without installation on multiple platforms.
Ray server is a beautiful, lightweight php app build on Laravel that helps you debug your app. It runs without installation on multiple platforms.

RayServer is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app. It runs without installation on multiple platforms.

May 16, 2022
Buggregator is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app.
Buggregator is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app.

A server for debugging more than just Laravel applications. Buggregator is a beautiful, lightweight web server built on Laravel and VueJs that helps d

May 16, 2022
Slim Framework Tracy Debugger Bar
 Slim Framework Tracy Debugger Bar

Slim Framework Tracy Debugger Bar configure it by mouse now in package: Panel Description Slim Framework - Slim Environment RAW data Slim Container RA

Feb 26, 2022
🔴 First class integration of Sentry to Nette Framework (@nette)
🔴 First class integration of Sentry to Nette Framework (@nette)

Website ?? contributte.org | Contact ????‍?? f3l1x.io | Twitter ?? @contributte Usage To install latest version of contributte/sentry use Composer. co

Jan 27, 2022