PHPackages                             phauthentic/correlation-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. phauthentic/correlation-id

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

phauthentic/correlation-id
==========================

Correlation ID and PSR7 middleware to inject it

2.0.0(2y ago)0100.7k↓40%12MITPHPPHP ^8.1CI failing

Since Dec 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Phauthentic/correlation-id)[ Packagist](https://packagist.org/packages/phauthentic/correlation-id)[ RSS](/packages/phauthentic-correlation-id/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (6)Versions (6)Used By (2)

Correlation ID
==============

[](#correlation-id)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Scrutinizer Coverage](https://camo.githubusercontent.com/5a73d25ec7fdf2e1357a72b2dfa4c04553d5aa41221c185c5cc0e9bbbd900b02/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f506861757468656e7469632f636f7272656c6174696f6e2d69642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Phauthentic/correlation-id/)[![Code Quality](https://camo.githubusercontent.com/da54ed620210a5ae98a84cc6bf3099988df515833870735b6b3ab559c51cadda/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f506861757468656e7469632f636f7272656c6174696f6e2d69642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Phauthentic/correlation-id/)

An implementation of a Correlation ID and a framework agnostic PSR 15-HTTP middlware.

> A Correlation ID, also known as a Transit ID, is a unique identifier value that is attached to requests and messages that allow reference to a particular transaction or event chain. The Correlation Pattern, which depends on the use of Correlation ID is a well documented Enterprise Integration Pattern.

- [The value of a correlation ID](https://blog.rapid7.com/2016/12/23/the-value-of-correlation-ids/)
- [Identity Correlation on Wikipedia](https://en.wikipedia.org/wiki/Identity_correlation)

Documentation
-------------

[](#documentation)

### The Correlation ID Value Object

[](#the-correlation-id-value-object)

The correlation ID is a singleton class that will always return the same ID for the current life-cycle of the request.

Calling `CorrelationID::toString()` will return a string and will return the same string for the whole live cycle of the application. You can compare a string to the Correlation ID by calling `CorrelationID::sameAs('your-string')`.

By default it uses its internal implementation to generate a UUID v4 as value of the Correlation ID. If you are using [ramsey/uuid](https://github.com/ramsey/uuid), it will use it automatically.

### PSR 15 HTTP Middleware

[](#psr-15-http-middleware)

The middleware will automatically put the correlation ID into your request object as attribute and header value. By default both use the `CorrelationID` name.

```
$middleware = new CorrelationIDMiddleware(
    CorrelationID::toString()
);
```

### Response

[](#response)

Since there is no standard for where this needs to be done, just add the correlation ID to your response where it suits your architecture or framework the best.

```
$response->withHeader('CorrelationID', CorrelationId::toString());
```

For Symfony there is a [bundle](https://github.com/Phauthentic/correlation-id-symfony-bundle) available that will automatically make the Correlation ID available in the request and response object.

Copyright &amp; License
-----------------------

[](#copyright--license)

Licensed under the [MIT license](LICENSE.txt).

Copyright (c) [Phauthentic](https://github.com/Phauthentic) / Florian Krämer

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 51.7% 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.

###  Release Activity

Cadence

Every ~392 days

Total

5

Last Release

828d ago

Major Versions

1.2.0 → 2.0.02024-03-27

PHP version history (3 changes)1.0.0PHP ^7.2

1.2.0PHP ^7.4 || ^8.0 || ^8.1

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0643e6255da841fe65260ec6e263d8908a40a84b884c32e9fc6be6a15e252fa8?d=identicon)[burzum](/maintainers/burzum)

---

Top Contributors

[![burzum](https://avatars.githubusercontent.com/u/162789?v=4)](https://github.com/burzum "burzum (15 commits)")[![floriankraemer](https://avatars.githubusercontent.com/u/4996022?v=4)](https://github.com/floriankraemer "floriankraemer (12 commits)")[![vanbrabantf](https://avatars.githubusercontent.com/u/12281411?v=4)](https://github.com/vanbrabantf "vanbrabantf (2 commits)")

---

Tags

correlation-identerprise-patternsphp7psr7-middleware

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phauthentic-correlation-id/health.svg)

```
[![Health](https://phpackages.com/badges/phauthentic-correlation-id/health.svg)](https://phpackages.com/packages/phauthentic-correlation-id)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.5k1.5M88](/packages/mcp-sdk)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[cakephp/authentication

Authentication plugin for CakePHP

1214.1M106](/packages/cakephp-authentication)[typo3/cms-core

TYPO3 CMS Core

3713.2M5.1k](/packages/typo3-cms-core)

PHPackages © 2026

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