Skip to content

Commit 92e4915

Browse files
committed
Add extra info to collectors
1 parent de98c24 commit 92e4915

File tree

6 files changed

+108
-29
lines changed

6 files changed

+108
-29
lines changed

docs/collectors.md

Lines changed: 100 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ hide:
1010

1111
This package includes some custom collectors:
1212

13-
- QueryCollector: Show all queries, including binding + timing
13+
- [QueryCollector](#querycollector): Show all queries, including binding + timing
1414
- RouteCollector: Show information about the current Route.
15-
- ViewCollector: Show the currently loaded views. (Optionally: display the shared data)
15+
- [ViewCollector](#viewcollector): Show the currently loaded views. (Optionally: display the shared data)
1616
- EventsCollector: Show all events
1717
- LaravelCollector: Show the Laravel version and Environment. (disabled by default)
1818
- SymfonyRequestCollector: replaces the RequestCollector with more information about the request/response
@@ -22,19 +22,22 @@ This package includes some custom collectors:
2222
- CacheCollector: Display all cache events. (disabled by default)
2323

2424
Bootstraps the following collectors for Laravel:
25+
2526
- LogCollector: Show all Log messages
2627
- SymfonyMailCollector for Mail
2728

2829
And the default collectors:
30+
2931
- PhpInfoCollector
3032
- MessagesCollector
31-
- TimeDataCollector (With Booting and Application timing)
33+
- [TimeDataCollector](#timeline-collector) (With Booting and Application timing)
3234
- MemoryCollector
3335
- ExceptionsCollector
3436

3537

3638
To enable or disable any of the collectors, set the configuration to `true` or `false`. Some collector have additional options in the configuration:
3739

40+
<details><summary>debugbar.php</summary>
3841

3942
```php
4043

@@ -75,7 +78,97 @@ To enable or disable any of the collectors, set the configuration to `true` or `
7578
'pennant' => false, // Display Pennant feature flags
7679
],
7780

78-
/*
81+
82+
83+
84+
```
85+
86+
</details>
87+
88+
### QueryCollector
89+
90+
The Query Collector has the following features
91+
- Show the executed queries including timing
92+
- Show/mark duplicate queries
93+
- Show used parameters
94+
- Run on-demand 'EXPLAIN' queries and link to Visual Explain (disabled bu default)
95+
- Copy the query to clipboard
96+
- Show the source of the query and open in editor
97+
- Visualize the duration of the queries with bottom border
98+
- Add queries to the timeline (disabled by default)
99+
- Limit the number of queries to avoid slowing down the Debugbar.
100+
- Exclude paths (eg. for session or vendors)
101+
- Show memory usage (disabled by default)
102+
103+
![Query Collector](img/queries.png)
104+
105+
```php
106+
'options' => [
107+
// ...
108+
'db' => [
109+
'with_params' => true, // Render SQL with the parameters substituted
110+
'exclude_paths' => [ // Paths to exclude entirely from the collector
111+
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
112+
],
113+
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
114+
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
115+
'timeline' => false, // Add the queries to the timeline
116+
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
117+
'explain' => [ // Show EXPLAIN output on queries
118+
'enabled' => false,
119+
],
120+
'hints' => false, // Show hints for common mistakes
121+
'show_copy' => true, // Show copy button next to the query,
122+
'slow_threshold' => false, // Only track queries that last longer than this time in ms
123+
'memory_usage' => false, // Show queries memory usage
124+
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
125+
'hard_limit' => 500, // After the hard limit, queries are ignored
126+
],
127+
// ...
128+
],
129+
```
130+
131+
### Timeline Collector
132+
133+
![Timeline Collector](img/timeline.png)
134+
135+
```php
136+
'options' => [
137+
'time' => [
138+
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
139+
],
140+
]
141+
```
142+
143+
### ViewCollector
144+
145+
The ViewCollector shows views and has the following features:
146+
147+
- Show used templates and source
148+
- Optionally add them to the timeline
149+
- Group similar views (useful for components)
150+
- Exclude folders (eg. for Filament or other vendors)
151+
- Optionally show data (this can be resource heavy)
152+
153+
![ViewCollector](img/views.png)
154+
155+
```php
156+
'options' => [
157+
'views' => [
158+
'timeline' => false, // Add the views to the timeline (Experimental)
159+
'data' => false, //true for all data, 'keys' for only names, false for no parameters.
160+
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
161+
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
162+
'vendor/filament' // Exclude Filament components by default
163+
],
164+
],
165+
]
166+
167+
```
168+
## Additional options
169+
170+
```php
171+
/*
79172
|--------------------------------------------------------------------------
80173
| Extra options
81174
|--------------------------------------------------------------------------
@@ -86,7 +179,7 @@ To enable or disable any of the collectors, set the configuration to `true` or `
86179

87180
'options' => [
88181
'time' => [
89-
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
182+
// See above
90183
],
91184
'messages' => [
92185
'trace' => true, // Trace the origin of the debug message
@@ -101,35 +194,14 @@ To enable or disable any of the collectors, set the configuration to `true` or `
101194
'show_guards' => true, // Show the guards that are used
102195
],
103196
'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
197+
// See above
121198
],
122199
'mail' => [
123200
'timeline' => false, // Add mails to the timeline
124201
'show_body' => true,
125202
],
126203
'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-
],
204+
// See above
133205
],
134206
'route' => [
135207
'label' => true, // show complete route on bar
@@ -151,5 +223,4 @@ To enable or disable any of the collectors, set the configuration to `true` or `
151223
],
152224
],
153225

154-
155226
```

docs/img/queries.png

66.8 KB
Loading

docs/img/timeline.png

33.3 KB
Loading

docs/img/views.png

48.8 KB
Loading

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ markdown_extensions:
5656
- pymdownx.inlinehilite
5757
- pymdownx.snippets
5858
- pymdownx.superfences
59+
- pymdownx.details
5960
- toc:
6061
permalink: true
6162
- pymdownx.magiclink:
@@ -68,3 +69,6 @@ extra:
6869
analytics:
6970
provider: google
7071
property: G-KVHB3EWT91
72+
73+
watch:
74+
- overrides

overrides/home.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ <h1>{{ config.site_description }}</h1>
5757
View on Github
5858
</a>
5959

60+
<div class="admonition tip">
61+
<p class="admonition-title">Live demo</p>
62+
<p>See an interactive example of the Laravel Debugbar in action below. <i>(Don't worry, this is just dummy data)</i></p>
63+
</div>
6064
</div>
6165
</div>
6266
</div>

0 commit comments

Comments
 (0)