bilfeldt/laravel-correlation-id
Laravel middleware that ensures every request has a globally unique Correlation-ID (and echoes any client Request-ID), adds them to the request/response headers, and injects both into the global log context for easier tracing across services, APIs, and jobs.
CorrelationIdMiddleware), minimizing gaps in traceability.LogContextMiddleware and Handler extensions demonstrate flexibility for integrating with existing logging/error-reporting tools (e.g., Sentry, Datadog).X-Request-ID, X-Correlation-ID) and Microsoft’s correlation ID best practices, ensuring interoperability with other services.Ramsey/UUID (included via Composer). No database or schema changes required.CorrelationIdMiddleware too late) could lead to missing IDs in logs/errors. Mitigation: Document and enforce middleware ordering in CI/CD checks.Illuminate\Http\Request, which could theoretically conflict with other packages. Mitigation: Isolate macros in a namespace or use a facade.Kernel.php, or is flexibility needed?Handler extensions.app/Http/Kernel.php to ensure CorrelationIdMiddleware is first.CorrelationIdMiddleware and ClientRequestIdMiddleware to Kernel.php.LogContextMiddleware and update Handler.php for error context.Ramsey/UUID (auto-installed via Composer). No other extensions needed.Request macros). Solution: Use a facade or namespace isolation.X-Request-ID to response.Handler.php updates. Ensure this runs after LogContextMiddleware.Request to verify ID generation.CorrelationIdMiddleware to change ID generation (e.g., use a database sequence).LogContextMiddleware is registered and Monolog is configured.CorrelationIdMiddleware runs.How can I help you explore Laravel packages today?