phauthentic/correlation-id-symfony-bundle

1.2.0 2024-04-01 22:14 UTC

This package is auto-updated.

Last update: 2024-04-01 22:17:42 UTC


README

PHP >= 8.1 phpstan Level 8 License: MIT Code Quality

This is a Symfony bridge for the framework agnostic Correlation ID library.

Features

  • Adds the Correlation ID to the Request and Response automatically.
    • Header names can be configured for each separately.
  • Provides a messenger stamp and middleware, that will add the CorrelationIDStamp to each message.

Installation

composer require phauthentic/correlation-id-symfony-bundle

Configuration

You can configure three different settings to control the behavior:

  • response_header_name - The name of the response header for the ID.
  • request_header_name - The name of the request header for the ID.
  • pass_through - If the ID from the request should be passed to the response enable this. This is useful if you are dealing with a microservice that is not exposed to the public but gets further actions delegated from the entry point and must retain the original ID.

config/correlation_id.yaml:

correlation_id:
    response_header_name: 'X-Correlation-ID'
    request_header_name: 'X-Correlation-ID'
    pass_through: false

Messenger Middleware

The messenger middleware will add the Correlation ID to your messages. Just add the middleware to your bus.

Copyright & License

Licensed under the MIT license.

Copyright (c) Phauthentic / Florian Krämer