โฑ๏ธServer Timing

The package provides a server timing facade to track application performance by adding Server-Timing headers. This feature is crucial for identifying and optimizing performance bottlenecks.

Setup

To enable server timing, add the ServerTimingMiddleware::class middleware to your HTTP Kernel. For the most accurate performance data, place this middleware at the top of the stack.

Laravel 11

Add the middleware in bootstrap/app.php:

return Application::configure(basePath: dirname(__DIR__))
    // ...
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->prepend(\CoreFoundation\Http\Middlewares\ServerTimingMiddleware::class);
    })
    // ...
    ->create();

Laravel 10 and Below

Add the middleware in app/Http/Kernel.php:

class Kernel extends HttpKernel
{
    protected $middleware = [
        \CoreFoundation\Http\Middlewares\ServerTimingMiddleware::class,
        // ...
    ];
}

Last updated

Was this helpful?