定制 benjamin-rqt/correlation-id 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

benjamin-rqt/correlation-id

Composer 安装命令:

composer require benjamin-rqt/correlation-id

包简介

README 文档

README

PHP >= 8.3 Symfony >= 6.0 phpstan Level 8

A Symfony bundle that provides an easy way to manage a Correlation ID across your application.

Features

  • Adds a Correlation ID to your application logs
  • Propagates the Correlation ID to other applications via HTTP headers
  • Exposes the Correlation ID in the response headers
  • Automatically reuses the Correlation ID from incoming requests when present
  • Generates a new Correlation ID when none is provided

Installation

composer require benjamin-rqt/correlation-id

Configuration

By default, the Correlation ID header name is X-Correlation-ID. You can override it if needed.

Available options

  • header_name – The HTTP header name used for the Correlation ID.

config/packages/correlation_id.yaml:

correlation_id:
    header_name: 'X-Correlation-ID'

HTTP Behavior

  • If a Correlation ID is present in the incoming request headers, it will be reused.
  • Otherwise, a new Correlation ID will be generated and used for the entire request lifecycle.
  • The Correlation ID is always added to the response headers.

Messenger Middleware

This bundle provides a Messenger middleware that automatically attaches the Correlation ID to dispatched messages.

To enable it, simply add the middleware to your Messenger bus configuration.

framework:
    messenger:
        buses:
            messenger.bus.default:
                middleware:
                    - correlation_id.middleware

This ensures that:

  • The Correlation ID from the HTTP request is propagated to Messenger messages
  • The same Correlation ID is available when handling messages asynchronously

统计信息

  • 总下载量: 590
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-02-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固