- Is snowflake/request-id a Laravel package?
- No. Despite the snowflake/request-id Composer name, the source repository is farzian/symfony-request-id, a Symfony bundle that registers listeners on Symfony's kernel.request and kernel.response events and relies on Symfony Flex for auto-registration. Laravel has no bundle registration, no services.yaml, and no equivalent event wiring, so nothing in it is drop-in for an Illuminate application.
- How do I install snowflake/request-id in a Laravel app?
- There is no supported way to install it as a Laravel package. You could technically composer require it and write an adapter that converts Illuminate\Http\Request into a Symfony Request, fires the listener, and copies the header back, but that is high ceremony and brittle across framework upgrades. The only sensible path is to read the source and reimplement the behavior as Laravel middleware.
- What is the Laravel equivalent of a request ID middleware?
- A single global middleware class of roughly 40 lines: read an inbound X-Request-Id, validate its format, reuse it when well-formed, otherwise generate a UUIDv4, bind it to the container as a singleton, and prepend it to the response. Register it globally and first in the stack so it wraps exception rendering too. Laravel 11+ ships the Context facade for pushing the ID into log context, and earlier versions use a Monolog processor.
- Should I trust a client-supplied X-Request-Id header?
- Never verbatim. Accepting an unvalidated inbound ID permits log injection and correlation spoofing, where a client forges IDs to merge or misattribute traces. Validate length, charset, and format against UUIDv4 or a strict hex pattern, and replace anything that fails with a generated ID. Also decide explicitly whether you trust IDs from your edge proxy only or from any client.
- Does snowflake/request-id put the request ID in logs and queued jobs?
- As described and evaluated it is header-only: it generates an ID and writes it to the request and response headers. There is no evidence of a Monolog processor, HTTP client propagation, or queue and messenger stamps. A header alone correlates nothing unless it also reaches your log context, outbound calls, and async job payloads.
- Which PHP and Symfony versions does snowflake/request-id support?
- There is no published CI matrix, no documented version constraints, and no release cadence to point at. You would have to inspect composer.json in the repository to see the actual PHP and Symfony constraints, and that repository may not be the source of truth for the Packagist entry. Treat unproven version support as a blocker for anything that touches every inbound request.
- Is snowflake/request-id safe to use in production?
- The risk is disproportionate to the value. It has no stars, no dependents, a score of zero, no visible maintainer team, no security policy, and no CVE history, and the package name does not match the repository owner, which is a supply-chain hygiene flag. For a component that intercepts every request, an unaudited single-maintainer dependency is a bad trade for something you can write in an afternoon.
- How do I test request-ID middleware in Laravel?
- Write three core assertions: a well-formed inbound ID is reused unchanged, a malformed or missing ID is replaced with a generated UUIDv4, and the ID appears on the response header. Add a fourth for your log context processor if you use one, and a fifth for job propagation if you stamp payloads. Laravel's HTTP test helpers cover the inbound-reuse case by sending a custom header.
- What header name should I use for request correlation?
- Match whatever your edge already emits, which is typically X-Request-Id, with X-Correlation-Id accepted as an alias. Staying consistent with ALB, Envoy, or Cloudflare avoids duplicate headers and keeps traces aligned with infrastructure logs. Document the accepted alias and normalize both into one internal value.
- What are the alternatives to snowflake/request-id for Laravel?
- For this narrow scope the real alternative is your own middleware rather than another dependency. If you prefer a package, look for a Laravel-specific one that ships a middleware, a Context or Monolog integration, and queue propagation, and check its download counts and recent release activity. The Symfony bundle is not an alternative here at all.