Skip to content

Commit a29e100

Browse files
committed
Add features/collectors
1 parent d7d0309 commit a29e100

File tree

6 files changed

+199
-49
lines changed

6 files changed

+199
-49
lines changed

docs/collectors.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
hide:
3+
- navigation
4+
---
5+
!!! warning
6+
7+
Debugbar can slow the application down (because it has to gather and render data). So when experiencing slowness, try disabling some of the collectors.
8+
9+
## Collectors
10+
11+
This package includes some custom collectors:
12+
13+
- QueryCollector: Show all queries, including binding + timing
14+
- RouteCollector: Show information about the current Route.
15+
- ViewCollector: Show the currently loaded views. (Optionally: display the shared data)
16+
- EventsCollector: Show all events
17+
- LaravelCollector: Show the Laravel version and Environment. (disabled by default)
18+
- SymfonyRequestCollector: replaces the RequestCollector with more information about the request/response
19+
- LogsCollector: Show the latest log entries from the storage logs. (disabled by default)
20+
- FilesCollector: Show the files that are included/required by PHP. (disabled by default)
21+
- ConfigCollector: Display the values from the config files. (disabled by default)
22+
- CacheCollector: Display all cache events. (disabled by default)
23+
24+
Bootstraps the following collectors for Laravel:
25+
- LogCollector: Show all Log messages
26+
- SymfonyMailCollector for Mail
27+
28+
And the default collectors:
29+
- PhpInfoCollector
30+
- MessagesCollector
31+
- TimeDataCollector (With Booting and Application timing)
32+
- MemoryCollector
33+
- ExceptionsCollector
34+
35+
36+
To enable or disable any of the collectors, set the configuration to `true` or `false`. Some collector have additional options in the configuration:
37+
38+
39+
```php
40+
41+
/*
42+
|--------------------------------------------------------------------------
43+
| DataCollectors
44+
|--------------------------------------------------------------------------
45+
|
46+
| Enable/disable DataCollectors
47+
|
48+
*/
49+
50+
'collectors' => [
51+
'phpinfo' => true, // Php version
52+
'messages' => true, // Messages
53+
'time' => true, // Time Datalogger
54+
'memory' => true, // Memory usage
55+
'exceptions' => true, // Exception displayer
56+
'log' => true, // Logs from Monolog (merged in messages if enabled)
57+
'db' => true, // Show database (PDO) queries and bindings
58+
'views' => true, // Views with their data
59+
'route' => true, // Current route information
60+
'auth' => false, // Display Laravel authentication status
61+
'gate' => false, // Display Laravel Gate checks
62+
'session' => true, // Display session data
63+
'symfony_request' => true, // Only one can be enabled..
64+
'mail' => false, // Catch mail messages
65+
'laravel' => false, // Laravel version and environment
66+
'events' => false, // All events fired
67+
'default_request' => false, // Regular or special Symfony request logger
68+
'logs' => false, // Add the latest log messages
69+
'files' => false, // Show the included files
70+
'config' => false, // Display config settings
71+
'cache' => false, // Display cache events
72+
'models' => false, // Display models
73+
'livewire' => true, // Display Livewire (when available)
74+
'jobs' => false, // Display dispatched jobs
75+
'pennant' => false, // Display Pennant feature flags
76+
],
77+
78+
/*
79+
|--------------------------------------------------------------------------
80+
| Extra options
81+
|--------------------------------------------------------------------------
82+
|
83+
| Configure some DataCollectors
84+
|
85+
*/
86+
87+
'options' => [
88+
'time' => [
89+
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
90+
],
91+
'messages' => [
92+
'trace' => true, // Trace the origin of the debug message
93+
],
94+
'memory' => [
95+
'reset_peak' => false, // run memory_reset_peak_usage before collecting
96+
'with_baseline' => false, // Set boot memory usage as memory peak baseline
97+
'precision' => 0, // Memory rounding precision
98+
],
99+
'auth' => [
100+
'show_name' => true, // Also show the users name/email in the debugbar
101+
'show_guards' => true, // Show the guards that are used
102+
],
103+
'db' => [
104+
'with_params' => true, // Render SQL with the parameters substituted
105+
'exclude_paths' => [ // Paths to exclude entirely from the collector
106+
'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
107+
],
108+
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
109+
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
110+
'timeline' => false, // Add the queries to the timeline
111+
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
112+
'explain' => [ // Show EXPLAIN output on queries
113+
'enabled' => false,
114+
],
115+
'hints' => false, // Show hints for common mistakes
116+
'show_copy' => true, // Show copy button next to the query,
117+
'slow_threshold' => false, // Only track queries that last longer than this time in ms
118+
'memory_usage' => false, // Show queries memory usage
119+
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
120+
'hard_limit' => 500, // After the hard limit, queries are ignored
121+
],
122+
'mail' => [
123+
'timeline' => false, // Add mails to the timeline
124+
'show_body' => true,
125+
],
126+
'views' => [
127+
'timeline' => false, // Add the views to the timeline (Experimental)
128+
'data' => false, //true for all data, 'keys' for only names, false for no parameters.
129+
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
130+
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
131+
'vendor/filament' // Exclude Filament components by default
132+
],
133+
],
134+
'route' => [
135+
'label' => true, // show complete route on bar
136+
],
137+
'session' => [
138+
'hiddens' => [], // hides sensitive values using array paths
139+
],
140+
'symfony_request' => [
141+
'hiddens' => [], // hides sensitive values using array paths, example: request_request.password
142+
],
143+
'events' => [
144+
'data' => false, // collect events data, listeners
145+
],
146+
'logs' => [
147+
'file' => null,
148+
],
149+
'cache' => [
150+
'values' => true, // collect cache values
151+
],
152+
],
153+
154+
155+
```

docs/features.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,6 @@
22
hide:
33
- navigation
44
---
5-
!!! warning
6-
7-
Debugbar can slow the application down (because it has to gather and render data). So when experiencing slowness, try disabling some of the collectors.
8-
9-
## Collectors
10-
This package includes some custom collectors:
11-
12-
- QueryCollector: Show all queries, including binding + timing
13-
- RouteCollector: Show information about the current Route.
14-
- ViewCollector: Show the currently loaded views. (Optionally: display the shared data)
15-
- EventsCollector: Show all events
16-
- LaravelCollector: Show the Laravel version and Environment. (disabled by default)
17-
- SymfonyRequestCollector: replaces the RequestCollector with more information about the request/response
18-
- LogsCollector: Show the latest log entries from the storage logs. (disabled by default)
19-
- FilesCollector: Show the files that are included/required by PHP. (disabled by default)
20-
- ConfigCollector: Display the values from the config files. (disabled by default)
21-
- CacheCollector: Display all cache events. (disabled by default)
22-
23-
Bootstraps the following collectors for Laravel:
24-
- LogCollector: Show all Log messages
25-
- SymfonyMailCollector for Mail
26-
27-
And the default collectors:
28-
- PhpInfoCollector
29-
- MessagesCollector
30-
- TimeDataCollector (With Booting and Application timing)
31-
- MemoryCollector
32-
- ExceptionsCollector
33-
34-
It also provides a facade interface (Debugbar) for easy logging Messages, Exceptions and Time.
35-
36-
To enable or disable any of the collectors, set the configuration to `true` or `false`. Some collector have additional options in the configuration.
37-
385

396
## AJAX Requests
407

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ hide:
55
- navigation
66
- toc
77
---
8+
9+
10+
It also provides a facade interface (Debugbar) for easy logging Messages, Exceptions and Time.

docs/installation.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Installation
22

3+
## Install with composer
34
!!! danger
45

56
Use the DebugBar only in development. Do not use Debugbar on publicly accessible websites, as it will leak information from stored requests (by design).
@@ -13,10 +14,45 @@ composer require barryvdh/laravel-debugbar --dev
1314

1415
Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
1516

16-
The Debugbar will be enabled when `APP_DEBUG` is `true`.
17-
1817
> If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.
1918
19+
20+
## Enable
21+
By default, Debugbar will be enabled when `APP_DEBUG` is `true`.
22+
23+
24+
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`
25+
26+
```php
27+
/*
28+
|--------------------------------------------------------------------------
29+
| Debugbar Settings
30+
|--------------------------------------------------------------------------
31+
|
32+
| Debugbar is enabled by default, when debug is set to true in app.php.
33+
| You can override the value by setting enable to true or false instead of null.
34+
|
35+
| You can provide an array of URI's that must be ignored (eg. 'api/*')
36+
|
37+
*/
38+
39+
'enabled' => env('DEBUGBAR_ENABLED', null),
40+
'hide_empty_tabs' => false, // Hide tabs until they have content
41+
'except' => [
42+
'telescope*',
43+
'horizon*',
44+
],
45+
46+
```
47+
48+
### Publish config
49+
50+
```shell
51+
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
52+
```
53+
54+
## Non-default installs
55+
2056
### Without auto-discovery
2157

2258
If you don't use auto-discovery, add the ServiceProvider to the providers list. For Laravel 11 or newer, add the ServiceProvider in bootstrap/providers.php. For Laravel 10 or older, add the ServiceProvider in config/app.php.
@@ -35,16 +71,6 @@ public function register(): void
3571
}
3672
```
3773

38-
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`
39-
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.
40-
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)
41-
42-
### Publish config
43-
44-
```shell
45-
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
46-
```
47-
4874
### With Octane
4975

5076
Make sure to add LaravelDebugbar to your flush list in `config/octane.php`.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ nav:
1212
- Install: installation.md
1313
- Usage: usage.md
1414
- Features: features.md
15+
- Collectors: collectors.md
1516

1617
theme:
1718
name: material

overrides/home.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ <h1>{{ config.site_description }}</h1>
4242
Laravel Debugbar is a package that integrates PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.
4343
</p>
4444

45+
{{ super() }}
46+
4547
<div class="mdx-hero__image">
4648
<img src="img/preview.png" alt="" width="1133" height="287" draggable="false">
4749
</div>
@@ -55,16 +57,12 @@ <h1>{{ config.site_description }}</h1>
5557
View on Github
5658
</a>
5759

58-
5960
</div>
6061
</div>
6162
</div>
6263
</section>
6364

6465
{% endblock %}
6566

66-
{% block content %}
67-
{{ super() }}
68-
{% endblock %}
6967

7068
{% block footer %}{% endblock %}

0 commit comments

Comments
 (0)