PHPackages                             softonic/laravel-middleware-request-id - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. softonic/laravel-middleware-request-id

ActiveLibrary[HTTP &amp; Networking](/categories/http)

softonic/laravel-middleware-request-id
======================================

Middleware for Laravel Framework to add the X-Request-ID header in the requests and responses.

3.0.1(4mo ago)15106.9k↓36.6%3Apache-2.0PHPPHP &gt;=8.5CI passing

Since Feb 8Pushed 4mo ago6 watchersCompare

[ Source](https://github.com/softonic/laravel-middleware-request-id)[ Packagist](https://packagist.org/packages/softonic/laravel-middleware-request-id)[ RSS](/packages/softonic-laravel-middleware-request-id/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (7)Used By (0)

softonic/laravel-middleware-request-id
======================================

[](#softoniclaravel-middleware-request-id)

[![Build Status](https://camo.githubusercontent.com/4497b77b9f3bcc61563493b32222a8839c19778eb589b9077937f4a667d74e6f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736f66746f6e69632f6c61726176656c2d6d6964646c65776172652d726571756573742d69642f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/softonic/laravel-middleware-request-id/actions)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.5
- Laravel 12.x

Install
-------

[](#install)

```
$ composer require softonic/laravel-middleware-request-id
```

Usage
-----

[](#usage)

### For all routes or a specific group

[](#for-all-routes-or-a-specific-group)

Add `Softonic\Laravel\Middleware\RequestId::class` in `App\Http\Kernel`.

For all routes:

```
protected $middleware = [
    \Softonic\Laravel\Middleware\RequestId::class,
    ....
]
```

Specific group:

```
// Example for WEB group
protected $middlewareGroups = [
        'web' => [
			\Softonic\Laravel\Middleware\RequestId::class,
			...
        ],

        'api' => [
            ...
        ],
    ];
```

### For a specific route

[](#for-a-specific-route)

Register the middleware as a route middleware in `App\Http\Kernel`.

```
    protected $routeMiddleware = [
		...
		'request-id' => Softonic\Laravel\Middleware\RequestId::class,
    ];
```

then, use it in your routes file, for example in `routes\web.php`

```
Route::get('route', function() {})->middleware('request-id');
```

### Extra

[](#extra)

If you need to have the X-Request-Id ASAP, you can modify `\App\Providers\AppServiceProvider::boot` adding `$_SERVER['HTTP_X_REQUEST_ID'] ??= \Ramsey\Uuid\Uuid::uuid4()->toString();`. This is going to allow you to use the X-Request-ID in the framework booting to for example customize monolog or in console executions.

Testing
-------

[](#testing)

To run the tests:

```
docker compose run --rm test
```

To run PHPUnit only:

```
docker compose run --rm phpunit
```

To check code style:

```
docker compose run --rm php composer run phpcs
```

To fix code style issues:

```
docker compose run --rm fixcs
```

To run static analysis:

```
docker compose run --rm php composer run phpstan
```

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance77

Regular maintenance activity

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~652 days

Recently: every ~815 days

Total

6

Last Release

125d ago

Major Versions

v1.0.1 → v2.0.02021-06-28

v2.1.0 → 3.0.02026-01-12

PHP version history (3 changes)v1.0.0PHP &gt;=7.0

v2.0.0PHP &gt;=7.4

3.0.0PHP &gt;=8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/524887?v=4)[Joskfg](/maintainers/Joskfg)[@joskfg](https://github.com/joskfg)

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

---

Top Contributors

[![josemanuel-cardona](https://avatars.githubusercontent.com/u/196229448?v=4)](https://github.com/josemanuel-cardona "josemanuel-cardona (3 commits)")[![joskfg](https://avatars.githubusercontent.com/u/524887?v=4)](https://github.com/joskfg "joskfg (3 commits)")[![Lotykun-Softonic](https://avatars.githubusercontent.com/u/130476160?v=4)](https://github.com/Lotykun-Softonic "Lotykun-Softonic (2 commits)")

---

Tags

middlewarelaraveltracking

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/softonic-laravel-middleware-request-id/health.svg)

```
[![Health](https://phpackages.com/badges/softonic-laravel-middleware-request-id/health.svg)](https://phpackages.com/packages/softonic-laravel-middleware-request-id)
```

###  Alternatives

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[matthewbdaly/laravel-etag-middleware

A Laravel middleware for adding ETags to HTTP requests to improve response times

64326.0k2](/packages/matthewbdaly-laravel-etag-middleware)[tomschlick/request-migrations

HTTP Request Migrations

1844.5k](/packages/tomschlick-request-migrations)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

2726.6k](/packages/shin1x1-laravel-force-https-url-scheme)[onlime/laravel-http-client-global-logger

A global logger for the Laravel HTTP Client

1935.1k](/packages/onlime-laravel-http-client-global-logger)

PHPackages © 2026

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