docs/collectors.md
!!! warning
Debugbar can slow the application down (because it has to gather and render data). So when experiencing slowness, try disabling some of the collectors.
This package includes with these Collectors enabled by default:
These collectors can be enabled in the config:
To enable or disable any of the collectors, set the configuration to true or false. Some collector have additional options in the configuration:
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => false, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
'models' => false, // Display models
'livewire' => true, // Display Livewire (when available)
'jobs' => false, // Display dispatched jobs
'pennant' => false, // Display Pennant feature flags
],
The Query Collector has the following features
'options' => [
// ...
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'exclude_paths' => [ // Paths to exclude entirely from the collector
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
],
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => false, // Add the queries to the timeline
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
],
'hints' => false, // Show hints for common mistakes
'show_copy' => true, // Show copy button next to the query,
'slow_threshold' => false, // Only track queries that last longer than this time in ms
'memory_usage' => false, // Show queries memory usage
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
'hard_limit' => 500, // After the hard limit, queries are ignored
],
// ...
],
Enable the options.db.explain option to run on-demand EXPLAIN queries for any SELECT query in the Debugbar.
This will update in the interface. You also have an option to navigate to mysqlexplain.com for a visual explain.
With Query Hard & Soft limits, you can reduce the amount of queries shown by default. When the soft limit is reached, bindings will be excluded.
When the hard limit is reached, the queries are excluded altogether to prevent loading too much data.
If you want to avoid any limits, you can set the option to null
The Message collectors gathers all messages from debug() calls and anything written to the logs.
You can pass multiple parameters to debug(), even complex object.
When calling debug(), the source of the call is shown and can be opened with your IDE.
When the Messages Collector is enabled, Log messages are added to the Messages tab. Otherwise a Monolog tab will show with just the log messages
<details><summary>config/debugbar.php</summary> 'options' => [
// ...
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'exclude_paths' => [ // Paths to exclude entirely from the collector
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
],
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => false, // Add the queries to the timeline
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
],
'hints' => false, // Show hints for common mistakes
'show_copy' => true, // Show copy button next to the query,
'slow_threshold' => false, // Only track queries that last longer than this time in ms
'memory_usage' => false, // Show queries memory usage
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
'hard_limit' => 500, // After the hard limit, queries are ignored
],
// ...
],
The ViewCollector shows views and has the following features:
'options' => [
'views' => [
'timeline' => false, // Add the views to the timeline (Experimental)
'data' => false, //true for all data, 'keys' for only names, false for no parameters.
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
'vendor/filament' // Exclude Filament components by default
],
],
]
'options' => [
'time' => [
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
],
]
This shows the current route and middleware.
<details><summary>config/debugbar.php</summary> 'options' => [
'route' => [
'label' => true, // show complete route on bar
],
],
Show any errors from the application, including traces.
You can manually add exceptions by calling debugbar()->addThrowable($throwable);
A simple widget showing the current PHP Version.
Show Request info, like headers, data, cookies etc. Sensitive data is hidden by default, but you can add your own sensitive data to the config.
<details><summary>config/debugbar.php</summary> 'options' => [
'symfony_request' => [
'hiddens' => [], // hides sensitive values using array paths, example: request_request.password
],
],
Show the Livewire components that are rendered on the page.
A simple widget showing the current PHP Version.
The Gate Collector shows the checks that have passed or failed.
This is similar to the Timeline buts adds all events. This can be a lot of data, so use with caution.
<details><summary>config/debugbar.php</summary> 'options' => [
'events' => [
'data' => false, // collect events data, listeners
],
],
A widget showing the current login status + a collector with more information.
<details><summary>config/debugbar.php</summary> 'options' => [
'auth' => [
'show_name' => true, // Also show the users name/email in the debugbar
'show_guards' => true, // Show the guards that are used
],
],
A collector showing the sent emails.
You can open a rendered preview of the email when the body is attached, by clicking 'View Mail'
A widget showing the current Laravel Version, environment and locale.
Show the Memory Usage of the application
<details><summary>config/debugbar.php</summary> 'options' => [
'memory' => [
'reset_peak' => false, // run memory_reset_peak_usage before collecting
'with_baseline' => false, // Set boot memory usage as memory peak baseline
'precision' => 0, // Memory rounding precision
],
]
!!! warning
Be careful when turning this on, as it can expose sensitive credentials. Make sure your app is not publicly available.
Shows the loaded configuration values.
Show the hits/misses of the Cache in a Timeline.
<details><summary>config/debugbar.php</summary> 'options' => [
'cache' => [
'values' => true, // collect cache values
], ],
Shows how often each Model is loaded. If this is high, you might want move some logic to SQL instead of processing large Collections.
Show the Jobs that are dispatched from this request.
Show the most recent logs from the log files in storage/logs
<details><summary>config/debugbar.php</summary> 'options' => [
'logs' => [
'file' => null, // Additional files
],
],
Shows all the Pennant flags that are checked during this request
!!! deprecated
This was mainly useful before OPcache was widely used, and this collector could be used for optimizing files. It's deprecated now.