Weave Code
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

Laravel Correlation Id Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enhanced Observability: Standardizes request tracing across Laravel applications, enabling seamless debugging in distributed systems by correlating logs, errors, and external API calls with unique IDs.
  • Compliance & Audit Readiness: Simplifies adherence to regulatory requirements (e.g., GDPR, HIPAA) by ensuring traceable request flows and structured logging.
  • Microservices & API Integrations: Critical for Laravel-based microservices or APIs that need to propagate correlation IDs to downstream services, improving cross-service debugging.
  • Performance & Reliability: Reduces mean time to resolution (MTTR) by providing clear request context in logs and error reports, especially in high-traffic or complex workflows.
  • Future-Proofing: Supports Laravel 10–13 and PHP 8.1–8.5, aligning with long-term tech stack upgrades and minimizing migration risks.
  • Developer Experience: Eliminates boilerplate code for correlation IDs, allowing teams to focus on core features while maintaining observability best practices.
  • Build vs. Buy Decision: Avoids reinventing middleware for correlation IDs, leveraging a lightweight, MIT-licensed package with active maintenance and community support.

When to Consider This Package

  • Adopt if:

    • Your Laravel application spans multiple services, queues, or external APIs requiring end-to-end request tracing.
    • You lack a centralized logging or observability solution (e.g., no ELK, Datadog, or similar) but still need correlation IDs for debugging.
    • Your team prioritizes structured logging and error context to improve incident response.
    • You’re using Laravel 10–13 and need a low-effort way to implement correlation IDs without custom middleware.
    • You want to standardize request IDs across client-server interactions (e.g., returning X-Request-ID in responses).
  • Look Elsewhere if:

    • You’re using a dedicated observability platform (e.g., OpenTelemetry, Jaeger) that already handles correlation IDs natively.
    • Your infrastructure (e.g., load balancer, API gateway) already injects correlation IDs before requests reach Laravel.
    • You need advanced correlation features (e.g., sampling, bagging) beyond basic UUID generation and header propagation.
    • Your application is monolithic with no external dependencies, making correlation IDs less critical.
    • You’re on an unsupported Laravel/PHP version (e.g., Laravel <10 or PHP <8.1).

How to Pitch It (Stakeholders)

For Executives: "This package adds a lightweight, zero-boilerplate solution to trace every user request across our Laravel services—like a digital breadcrumb trail for debugging. By automatically attaching unique IDs to logs, errors, and API calls, we’ll slash the time spent diagnosing issues in production, especially in distributed systems. It’s a low-risk, high-reward upgrade that aligns with our observability goals and compliance needs, with minimal dev effort."

For Engineering/DevOps: *"This middleware handles correlation IDs and request tracing for us out-of-the-box, saving weeks of custom development. It:

  • Auto-generates UUIDs for every request and propagates them via headers.
  • Injects IDs into logs and errors for seamless debugging.
  • Works with queues and external APIs to maintain context.
  • Supports Laravel 10–13 and PHP 8.1+ with minimal setup. We just add 3 lines of middleware to Kernel.php and Handler.php, and we’re done. No reinventing the wheel—just plug-and-play observability."*

For Developers: *"This package lets us:

  • Stop manually tracking request IDs—it’s handled automatically.
  • Correlate logs, errors, and API calls with a single ID per request.
  • Support future Laravel upgrades without breaking changes. Setup is trivial: add the middleware to Kernel.php, tweak Handler.php for errors, and we’re good. It’s MIT-licensed, actively maintained, and integrates with Laravel’s built-in logging system."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor