jaguarsoft/laravel-debugbar

Handle Debugbar Enabling by Middleware

5.2.0 2022-05-07 21:06 UTC

This package is auto-updated.

Last update: 2024-11-24 09:07:37 UTC


README

This package allows you to enable the Debugbar on deman, despite being disabled by configuration.

Installation

composer require jaguarsoft/laravel-debugbar

Configuration

config/app.php

'providers' => [   
    /** **/ 
    // Barryvdh\Debugbar\ServiceProvider::class,
    JaguarSoft\LaravelDebugbar\Provider\DebugbarServiceProvider::class,
],
'aliases' => [
    /** **/
    'Debugbar' => Barryvdh\Debugbar\Facade::class,
],

Use

To load Enabled for All

DEBUGBAR_ENABLED=true

To load Disable for All, enabled after in a Middleware

DEBUGBAR_ENABLED=false

To load Enabled when APP_DEBUG=true

DEBUGBAR_ENABLED=null

Middleware

public function handle($request, Closure $next){
    if(/* your validation*/){
        \Debugbar::enable();
    }
    return $next($request);
}

Example Middleware: https://gist.github.com/laurenceHR/911050c675eb5a1d28b761b61b3b25a0

Used and Tested in Laravel 5.2, 5.3, 5.4 Is not necessary in Laravel 5.5 because with "barryvdh/laravel-debugbar" version "~3.4.2" has this feature included.