PHPackages                             chuxiangqaz/x-request-id - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. chuxiangqaz/x-request-id

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chuxiangqaz/x-request-id
========================

对 lumen/laravel 项目 x-request-id 的包

00PHP

Since Dec 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chuxiangqaz/request-id)[ Packagist](https://packagist.org/packages/chuxiangqaz/x-request-id)[ RSS](/packages/chuxiangqaz-x-request-id/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

x-request-id for lumen
======================

[](#x-request-id-for-lumen)

> **对 lumen/laravel 项目 x-request-id 的包**

- 日志增加 request id
- HTTP/CLI/QUEUE 增加 request id
- 请求别的第三方服务增加 request id
- \[\] 响应增加 request id

快速使用
----

[](#快速使用)

1. 安装

```
composer require chuxiangqaz/x-request-id

```

2. 使用

```
// vim bootstrap/app.php
$app->register(\XRequestID\AppServiceProvider::class);
$app->register(\XRequestID\Logging\LoggingProvider::class);
```

文档说明
----

[](#文档说明)

### 1. 如何在请求别的第三方服务增加 request id

[](#1-如何在请求别的第三方服务增加-request-id)

```
use GuzzleHttp\Client;

$cof = [
    'options'      => [
        'timeout'  => 60.0,
        'headers'  => [
            'Content-type' => 'application/json',
        ],
        'handler' => \App\MiddleWare::getHandlerStack(),
        'debug' => true
    ],
];

$client = new Client($cof);
$response = $client->get('http://httpbin.org/get');
```

### 2. queue 的日志的 requestID是什么样子呢

[](#2-queue-的日志的-requestid是什么样子呢)

因为队列的request id 是针对单个消息的，因此不一样的消息 request id 不一样。形式全部如下: ` ${request_id}_${msg_id}`

```
// 假设服务启动的时候
$requestId = '0bdff8095c8bf1b38775bf35547a1317';
// 从队列中拿取的消息id = 5cf41e52d71e8f9417c3c6de0741cf67
// 则我们全局的 request id, 以及日志中的:
$requestId  = '0bdff8095c8bf1b38775bf35547a1317_5cf41e52d71e8f9417c3c6de0741cf67'

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/16b8082b21047758fefcc493667bed589710fe0426fdb8a63f3c2e21070831f2?d=identicon)[chuxiangqaz](/maintainers/chuxiangqaz)

---

Top Contributors

[![chuxiangqaz](https://avatars.githubusercontent.com/u/20558417?v=4)](https://github.com/chuxiangqaz "chuxiangqaz (1 commits)")

### Embed Badge

![Health badge](/badges/chuxiangqaz-x-request-id/health.svg)

```
[![Health](https://phpackages.com/badges/chuxiangqaz-x-request-id/health.svg)](https://phpackages.com/packages/chuxiangqaz-x-request-id)
```

###  Alternatives

[butschster/meta-tags

The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project

628730.7k2](/packages/butschster-meta-tags)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
