evonext/tracy

A EvoNext CMS Package to integrate Nette Tracy Debugger

1.1.2 2022-12-27 14:25 UTC

This package is not auto-updated.

Last update: 2024-04-30 21:09:46 UTC


README

Better Exception Handler

Total Downloads Latest Stable Version Latest Unstable Version License Monthly Downloads Daily Downloads

Laravel Tracy

Features

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

Installation

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

composer require evonext/tracy --dev

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

{
    "require-dev": {
        "evonext/tracy": "^1.0"
    }
}

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

'providers' => [
    ...
    EvoNext\Tracy\TracyServiceProvider::class,
    ...
];

If you see Route tracy.bar not defined, please run artisan route:clear once

artisan route:clear

Config

Basic settings can be changed using environment variables:

TRACY_ENABLED=true        # true | false | 'manager' | 'web'
TRACY_SHOW_BAR=true       # true | false
TRACY_EXCEPTION=true      # true | false
TRACY_MGR_TOP_FRAME=false # true | false

Publish config

If you need to change other settings, publish the configuration:

php artisan vendor:publish --provider="EvoNext\Tracy\TracyServiceProvider"

The /config directory will contain the file tracy.php, which you can change as you see fit.

return [

    /* Activate tracy
    |--------------------------------------------------------------------------
    | Available values:
    | true      – Enable for any context
    | false     – Disable for any context
    | 'manager' – Enable only for manager context (admin area)
    | 'web'     – Enable only for web context (public area)
    |-------------------------------------------------------------------------- */

    'enabled' => env('TRACY_ENABLED', env('APP_DEBUG') === true),

    /* Show bar
    |-------------------------------------------------------------------------- */

    'showBar' => env('TRACY_SHOW_BAR', env('APP_ENV') !== 'production'),

    /* Show exceptions
    |-------------------------------------------------------------------------- */

    'showException' => env('TRACY_EXCEPTION', true),

    /* The URL prefix for the manager dashboard
    |-------------------------------------------------------------------------- */

    'managerPrefix' => 'admin',

    /* The URL prefix for a frame top level the manager dashboard
    |-------------------------------------------------------------------------- */

    'managerTopRoute' => 'main',

    /* If true tracy shown bar in a frame top level
    | instead pages frames in the manager context
    |-------------------------------------------------------------------------- */

    'enabledInTopFrame' => env('TRACY_MGR_TOP_FRAME', false),

    'route'         => [
        'prefix' => 'tracy',
        'as'     => 'tracy.',
    ],
    'accepts'       => [
        'text/html',
    ],
    'appendTo'      => 'body',
    'editor'        => 'editor://%action/?file=%file&line=%line&search=%search&replace=%replace',
    'maxDepth'      => 4,
    'maxLength'     => 1000,
    'scream'        => true,
    'showLocation'  => true,
    'strictMode'    => true,
    'editorMapping' => [],
    'panels'        => [
        'routing'        => true,
        'database'       => true,
        'view'           => true,
        'event'          => false,
        'session'        => true,
        'request'        => true,
        'auth'           => true,
        'html-validator' => false,
    ],
];

Editor Link

See https://tracy.nette.org/en/open-files-in-ide

Debugger Bar

Images clickable

@bdump Ajax SysInfo Route
bdump.png ajax.png systeminfo.png route.png
View Session Request Login
view.png session.png request.png login.png

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',
                ...
            ];
        });
    }
}

Thanks