PHPackages                             gradints/laravel-benchmark-route - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. gradints/laravel-benchmark-route

ActiveLaravel-plugin[Logging &amp; Monitoring](/categories/logging)

gradints/laravel-benchmark-route
================================

Adds elapsed time to controller response

v0.0.4(1mo ago)08↓100%MITPHPPHP ^8.2

Since Apr 21Pushed 1mo agoCompare

[ Source](https://github.com/gradints/laravel-benchmark-route)[ Packagist](https://packagist.org/packages/gradints/laravel-benchmark-route)[ RSS](/packages/gradints-laravel-benchmark-route/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

gradints/laravel-benchmark-route
================================

[](#gradintslaravel-benchmark-route)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ecb15ebfb874c92744f73ebf8e52de6173bce00da2536b4552ac3d88d354f014/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67726164696e74732f6c61726176656c2d62656e63686d61726b2d726f7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gradints/laravel-benchmark-route)

This package provides a middleware that adds the elapsed time of a controller action to the response headers. It is designed to be used in Laravel applications and can be easily integrated into your existing routes.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require --dev gradints/laravel-benchmark-route
```

After installing it, you need to register the middleware in your bootstrap/app.php file:

```
use Gradin\LaravelBenchmarkRoute\Middleware\BenchmarkMiddleware;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Sentry\Laravel\Integration;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        channels: __DIR__.'/../routes/channels.php',
        health: '/up',
        apiPrefix: '',
    )
    ->withMiddleware(function (Middleware $middleware): void {
        if (class_exists(BenchmarkMiddleware::class)) {
            // register BenchmarkMiddleware for web and api routes
            $middleware->web(BenchmarkMiddleware::class);
            $middleware->api(BenchmarkMiddleware::class);
        }
    });
```

Usage
-----

[](#usage)

```
use Gradin\LaravelBenchmarkRoute\Attributes\Benchmark;
use Illuminate\Http\Resources\Json\JsonResource;

class ProductController extends Controller
{
    #[Benchmark]
    public function index()
    {
        $products = Product::paginate(20);

        return JsonResource::collection($products);
    }
}
```

And the response will be like this:

```
{
  "data": [
    // products
  ],
  "meta": {
    // pagination meta data
  },
  "benchmark": {
    "time": "1,230.93"
  }
}
```

You can also give boolean as an argument to enable or disable the benchmark

```
#[Benchmark(true)]
#[Benchmark(false)]
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f302e247ba924cab3ffb82055f44495626c56c2247ffd369f269f2ae3e35d6ff?d=identicon)[christhofer](/maintainers/christhofer)

---

Top Contributors

[![christhofer](https://avatars.githubusercontent.com/u/13524958?v=4)](https://github.com/christhofer "christhofer (5 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/gradints-laravel-benchmark-route/health.svg)

```
[![Health](https://phpackages.com/badges/gradints-laravel-benchmark-route/health.svg)](https://phpackages.com/packages/gradints-laravel-benchmark-route)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
