You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-10Lines changed: 31 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
1
# Laravel Server Timings
2
2
3
3
[](https://packagist.org/packages/beyondcode/laravel-server-timing)
To add server-timing header information, you need to add the `\BeyondCode\ServerTiming\Middleware\ServerTimingMiddleware::class,` middleware to your HTTP Kernel.
21
19
In order to get the most accurate results, put the middleware as the first one to load in the middleware stack.
By default, the middleware measures only three things, to keep it as light-weight as possible:
24
45
25
46
- Bootstrap (time before the middleware gets called)
@@ -35,9 +56,12 @@ Once the package is successfully installed, you can see your timing information
35
56
If you want to provide additional measurements, you can use the start and stop methods. If you do not explicitly stop a measured event, the event will automatically be stopped once the middleware receives your response. This can be useful if you want to measure the time your Blade views take to compile.
* @method static \BeyondCode\ServerTiming\ServerTiming addMetric(string $metric) Add new event with null duration.
10
+
* @method static bool hasStartedEvent(string $key) Check if a event has been created already.
11
+
* @method static \BeyondCode\ServerTiming\ServerTiming measure(string $key) Stop existing event and record its duration, else start a new event.
12
+
* @method static \BeyondCode\ServerTiming\ServerTiming stop(string $key) Stop a timed event and record its duration.
13
+
* @method static void stopAllUnfinishedEvents() Stop all running events.
14
+
* @method static \BeyondCode\ServerTiming\ServerTiming setDuration(string $key, float|int|callable $duration) Set the duration for an event if $duration is number, else record elapsed time to run a user function if $duration is callable.
15
+
* @method static float|int|null getDuration(string $key) Retrieve the duration an event has taken.
16
+
* @method static array events() Get the list of finished events with their associated duration.
0 commit comments