A Laravel Package to integrate Nette Tracy Debugger

Overview

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

Comments
  • v1.0.19 not compatible with PHP 5.4

    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"
            }
    }
    
    opened by bestlong 9
  • 請問關於使用sentinel auth套件 在AuthPanel

    請問關於使用sentinel auth套件 在AuthPanel

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

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

    opened by imagine10255 8
  • Tracy dump() and barDump() methods don't print the desired variables

    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.

    opened by TeeJay-net 7
  • Tracy Handler.php render method checks if response->getContent instance of View, but is string so never returns view.

    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?)

    opened by jrbarnard 5
  • Tracy killing session flash message

    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.

    opened by ApeWare 5
  • 1.8.23 在 Laravel 5.8 無法處理 AJAX 請求

    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

    opened by jyhsu2000 4
  • 500 internal server error when ?_tracy_bar=assets in the URL

    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

    opened by jakubkratina 4
  • Tracy debug config not working

    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 不太清楚有沒有影響

    opened by magussiro 4
  • How to disable on local env ?

    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 ?

    opened by sarfraznawaz2005 4
  • Error in Auth showing at AJAX bar

    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

    opened by littpi-zz 3
  • How do set an email address for alerts in the config

    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', 'alertemail@invalid'); Debugger::getLogger()->emailSnooze = 30;

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

    opened by ghost 3
  • Where is the best place to automatically/globally log all queries?

    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

    opened by mikepsinn 0
Releases(v1.15.1)
Owner
Recca Tsai
Recca Tsai
🔴 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

Contributte 3 Dec 15, 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 - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo

Nette Foundation 1.6k Dec 23, 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

Xdebug 2.8k Jan 3, 2023
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

Joe Watkins 841 Oct 9, 2022
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

Sidharth Kshatriya 709 Dec 30, 2022
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

Renato Cassino 190 Dec 3, 2022
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

Swoole Project 319 Dec 25, 2022
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

Renato Cassino 190 Dec 3, 2022
Simple php debugger

Debugger Description Simple debugger for php Requirements PHP 5.5+ to 8.0 Usage new \Debugger\Debugger( true, // work mode [false - disable, 'FILE' -

null 0 Aug 10, 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

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

Galahad 301 Dec 26, 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

Marcel Pociot 923 Dec 16, 2022
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

Barry vd. Heuvel 14.8k Jan 9, 2023
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

Facade 2k Jan 1, 2023
: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

Raphaël Huchet 2.9k Jan 5, 2023
: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

ARCANEDEV 2.3k Dec 30, 2022
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

The Laravel Framework 4.4k Dec 27, 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.

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

Pavel Buchnev 310 Jan 2, 2023
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

Buggregator 311 Jan 4, 2023