PHP code example of evonext / tracy

1. Go to this page and download the library: Download evonext/tracy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

evonext / tracy example snippets


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

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,
    ],
];
dotenv
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
bash
php artisan vendor:publish --provider="EvoNext\Tracy\TracyServiceProvider"

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