Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Xrequestuid Bundle

Xrequestuid Bundle Laravel Package

m6web/xrequestuid-bundle

A Symfony bundle that assigns a unique ID to each incoming request and exposes it via the X-Request-Uid header, making it easy to correlate logs and trace requests across services. Lightweight, simple to install, and works with Symfony's request/response cycle.

View on GitHub
Deep Wiki
Context7

bundle sf2 allowing setting ids in headers propagated via guzzle

Frequently asked questions about Xrequestuid Bundle
Is m6web/xrequestuid-bundle a Laravel package or a Symfony bundle?
It is a Symfony bundle, not a Laravel package. It hooks Symfony's kernel.request and kernel.response events and registers a DI extension with its own configuration tree. Laravel has no bundle system, no kernel.* events, and a different container and config model, so there is no ServiceProvider or Laravel-facing contract to plug into. For a Laravel application the repository is best read as a behaviour specification rather than a dependency.
Can I install m6web/xrequestuid-bundle in a Laravel app?
You can add it to composer.json, but expect the install to fail: the last release is from January 2020 and its PHP and symfony/* constraints will usually conflict with Laravel 10 or 11 and their PHP 8.1+ and Symfony 6/7 transitive requirements. Even if it installs, there is nothing in Laravel's request lifecycle to wire it into. The realistic path is to reimplement the same behaviour as a small middleware of roughly 150 to 250 lines.
Is m6web/xrequestuid-bundle still maintained?
No. The project is explicitly marked DEPRECATED, the repository is archived, and the last release was 2020-01-30, so there is no security response channel, no PHP 8.x or Symfony 6+ guarantees, and no maintainer to escalate to. It has only a handful of stars, no dependents, and a low package score, so there is no production evidence to borrow. If adoption is mandated, you are effectively taking on a fork.
What does the X-Request-UID header actually do?
The bundle reuses an X-Request-UID header when one is already present and otherwise generates a unique identifier for each incoming request. That value is then exposed to the application, to Monolog records, and to outbound HTTP calls so a single request can be traced across logs and services. The header name and generation behaviour are configurable through the bundle's Symfony configuration.
How do I add a request ID to every Laravel request without this bundle?
Write a middleware that accepts a trusted inbound header or generates a UUID, stores the value on the request, and echoes it back on the response. Register it globally in the HTTP kernel and bind the value so controllers, services, and log taps can read it. Keeping the header name and generation strategy identical to the original bundle gives you the same behaviour with first-party code you control.
How do I add a request ID to Laravel logs?
Use Log::withContext() or the Context facade to push the request ID into every log record for the current request, typically from the same middleware that generates the ID. Add the field to your Monolog formatter so it appears on each line, and reuse the same key name across services. One canonical field name is what makes cross-service searching work later.
How do I forward X-Request-UID to downstream HTTP calls in Laravel?
Set the header once in a shared client factory using Http::withHeaders(), or as a global Guzzle middleware, so every outbound call carries the current request ID. Register it where the client is constructed rather than at each call site. A facade macro or a default header set at boot covers most Laravel HTTP client usage.
Should I trust an inbound X-Request-UID header from external clients?
Only if the value comes from a trusted internal hop. Accepting an arbitrary X-Request-UID from public clients lets callers forge or collide identifiers, which poisons logs and can undermine correlation assumptions or log masking. Validate the format, cap the length, and regenerate the ID at your public edge when you do not control the sender.
How do I propagate a request ID to queued jobs and console commands?
Queued jobs and console commands run outside the original request, so the ID is not automatically available and the trace chain breaks. Capture the current request ID when dispatching, pass it as job data, and restore it in the JobProcessing listener or at the start of the handle method. Do the same for scheduled commands; this is the most common gap when request IDs are added ad hoc.
What are the alternatives to a bespoke X-Request-UID header?
Laravel's Context facade, W3C Trace Context with the traceparent header, and OpenTelemetry all solve correlation with maintained, interoperable implementations. If you need APM integration with Datadog, Sentry, Honeycomb, or an OTel Collector now or within twelve months, a custom 2020 header convention risks becoming a private scheme you cannot federate. A simple UID middleware is still a fine fit when log correlation is the only requirement.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect