“Laravel Debugbar” Réponses codées

Laravel Debugbar

composer require barryvdh/laravel-debugbar --dev
  
// config/app.php
// ServiceProviders
Barryvdh\Debugbar\ServiceProvider::class,
// Facades
'Debugbar' => Barryvdh\Debugbar\Facade::class,


php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
Envious Echidna

Laravel Debug

composer require barryvdh/laravel-debugbar --dev
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
Blue-eyed Bison

Laravel Debugbar

# with auto-discovery:
composer require barryvdh/laravel-debugbar --dev
Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

# without auto-discovery:

# If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

Barryvdh\Debugbar\ServiceProvider::class,
  
# If you want to use the facade to log messages, add this to your facades in app.php:

'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class,
  
# The profiler is enabled by default, if you have APP_DEBUG=true. You can override that in the config (debugbar.enabled) or by setting DEBUGBAR_ENABLED in your .env. See more options in config/debugbar.php You can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false. You can also only display the js or css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to true for syntax highlighting)

# Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"



# Laravel with Octane:
# Make sure to add LaravelDebugbar to your flush list in config/octane.php.

    'flush' => [
        \Barryvdh\Debugbar\LaravelDebugbar::class,
    ],
# Lumen:
For Lumen, register a different Provider in bootstrap/app.php:

if (env('APP_DEBUG')) {
 $app->register(Barryvdh\Debugbar\LumenServiceProvider::class);
}
# To change the configuration, copy the file to your config folder and enable it:

$app->configure('debugbar');


# 
# Usage
# You can now add messages using the Facade (when added), using the PSR-3 levels (debug, info, notice, warning, error, critical, alert, emergency):

Debugbar::info($object);
Debugbar::error('Error!');
Debugbar::warning('Watch out…');
Debugbar::addMessage('Another message', 'mylabel');

# And start/stop timing:

Debugbar::startMeasure('render','Time for rendering');
Debugbar::stopMeasure('render');
Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
Debugbar::measure('My long operation', function() {
    // Do something…
});

# Or log exceptions:

try {
    throw new Exception('foobar');
} catch (Exception $e) {
    Debugbar::addThrowable($e);
}
Irfan

Laravel Debugbar Faux

APP_DEBUG=false # No error reporting at all
or
DEBUGBAR_ENABLED=false # deguger is disabled but error reporting works
Shadow

Laravel Debugbar

'Debugbar' => 'Barryvdh\Debugbar\Facade',
Irfan

Laravel Debugbar

'Barryvdh\Debugbar\ServiceProvider',
Irfan

Réponses similaires à “Laravel Debugbar”

Questions similaires à “Laravel Debugbar”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code