PHPackages                             manomano-tech/correlation-ids-monolog - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. manomano-tech/correlation-ids-monolog

Abandoned → not maintained any moreArchivedLibrary[Logging &amp; Monitoring](/categories/logging)

manomano-tech/correlation-ids-monolog
=====================================

Monolog processor for manomano-tech/correlation-ids package

1.0.0(7y ago)221.0k1MITPHPPHP ^7.1.3

Since Sep 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ManoManoTech/correlation-ids-monolog)[ Packagist](https://packagist.org/packages/manomano-tech/correlation-ids-monolog)[ RSS](/packages/manomano-tech-correlation-ids-monolog/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (1)

Inactive
========

[](#inactive)

**📢 Note:** This repository is not maintained any more.

Monolog Correlation plugin
==========================

[](#monolog-correlation-plugin)

Injects correlation ids in all records.

Installation
------------

[](#installation)

```
composer require manomano-tech/correlation-ids-monolog
```

Usage
-----

[](#usage)

```
use ManoManoTech\CorrelationId\CorrelationEntryName;
use ManoManoTech\CorrelationId\Factory\HeaderCorrelationIdContainerFactory;
use ManoManoTech\CorrelationId\Generator\RamseyUuidGenerator;
use ManoManoTech\CorrelationIdMonolog\CorrelationIdProcessor;
use Monolog\Logger;

// We specify which generator will be responsible for generating the
// identification of the current process
$generator = new RamseyUuidGenerator();

// We define what are the http header names to look for
// this is optional. We show the default values here.
$correlationEntryNames = new CorrelationEntryName(
    'current-correlation-id',
    'parent-correlation-id',
    'root-correlation-id'
);

$factory = new HeaderCorrelationIdContainerFactory(
    $generator,
    $correlationEntryNames
);
$correlationIdContainer = $factory->create(getallheaders());

// now you can create your monolog processor

$processor = new CorrelationIdProcessor($correlationIdContainer);

$logger = new Logger('channel-name');
$logger->pushProcessor([$processor]);

$logger->addInfo('message');
```

Customizing output format
-------------------------

[](#customizing-output-format)

### Entry names

[](#entry-names)

By default, values will be rendered like this:

```
$record = [
    'extra' => [
        'current' => '6a051d24-aa5b-4c57-bcb4-bbbb7eda1c16',
        'parent' => '3fc044d9-90fa-4b50-b6d9-3423f567155f',
        'root' => '3b5263fa-1644-4750-8f11-aaf61e58cd9e',
    ],
];
```

You can change this by providing a second argument to the constructor:

```
use ManoManoTech\CorrelationId\CorrelationEntryName;
use ManoManoTech\CorrelationIdMonolog\CorrelationIdProcessor;
use Monolog\Logger;

$correlationEntryName = new CorrelationEntryName(
    'current-id',
    'parent-id',
    'root-id'
);

$processor = new CorrelationIdProcessor(
    $correlationIdContainer,
    $correlationEntryName
);

$logger = new Logger('channel-name');
$logger->pushProcessor([$processor]);

$logger->addInfo('message');
```

will produce:

```
$record = [
    'extra' => [
        'current-id' => '6a051d24-aa5b-4c57-bcb4-bbbb7eda1c16',
        'parent-id' => '3fc044d9-90fa-4b50-b6d9-3423f567155f',
        'root-id' => '3b5263fa-1644-4750-8f11-aaf61e58cd9e',
    ],
];
```

### Group request correlation identifier in one entry

[](#group-request-correlation-identifier-in-one-entry)

By default, the processor will add an entry in the `extra` section for every correlation id key.

You can group all the id in one array:

```
use ManoManoTech\CorrelationIdMonolog\CorrelationIdProcessor;
use Monolog\Logger;

$processor = new CorrelationIdProcessor($correlationIdContainer);
$processor->groupCorrelationIdsInOneArrayWithKey('correlation');

$logger = new Logger('channel-name');
$logger->pushProcessor([$processor]);

$logger->addInfo('message');
```

will produce:

```
$record = [
    'extra' => [
        'correlation' => [
            'current' => '6a051d24-aa5b-4c57-bcb4-bbbb7eda1c16',
            'parent' => '3fc044d9-90fa-4b50-b6d9-3423f567155f',
            'root' => '3b5263fa-1644-4750-8f11-aaf61e58cd9e',
        ],
    ],
];
```

### Skip empty correlation id

[](#skip-empty-correlation-id)

By default, the processor will add every correlation id even if they are empty.

```
$record = [
    'extra' => [
        'current' => '6a051d24-aa5b-4c57-bcb4-bbbb7eda1c16',
        'parent' => null,
        'root' => null,
    ],
];
```

You can change this behavior with the `skipEmptyValues` method:

```
use ManoManoTech\CorrelationIdMonolog\CorrelationIdProcessor;
use Monolog\Logger;

$processor = new CorrelationIdProcessor($CorrelationIdContainer);
$processor->skipEmptyValues();

$logger = new Logger('channel-name');
$logger->pushProcessor([$processor]);

$logger->addInfo('message');
```

will produce:

```
$record = [
    'extra' => [
        'current' => '6a051d24-aa5b-4c57-bcb4-bbbb7eda1c16',
    ],
];
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

2780d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dbbe3750e8a096e36b66917148ab246fbe1b5abdce72c3dd2c5e4c6e2c0c1695?d=identicon)[ManoManoTech](/maintainers/ManoManoTech)

---

Top Contributors

[![juliendufresne](https://avatars.githubusercontent.com/u/1397529?v=4)](https://github.com/juliendufresne "juliendufresne (6 commits)")[![edouard-lopez](https://avatars.githubusercontent.com/u/1212392?v=4)](https://github.com/edouard-lopez "edouard-lopez (2 commits)")[![greg0ire](https://avatars.githubusercontent.com/u/657779?v=4)](https://github.com/greg0ire "greg0ire (1 commits)")

---

Tags

logplugintracingmonologprocessorcorrelation-idcorrelation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/manomano-tech-correlation-ids-monolog/health.svg)

```
[![Health](https://phpackages.com/badges/manomano-tech-correlation-ids-monolog/health.svg)](https://phpackages.com/packages/manomano-tech-correlation-ids-monolog)
```

###  Alternatives

[egeniq/monolog-gdpr

Some Monolog processors that will help in relation to the security requirements under GDPR.

538.7k](/packages/egeniq-monolog-gdpr)[glopgar/monolog-timer-processor

A processor for Monolog that adds timing info to the message contexts

1469.6k](/packages/glopgar-monolog-timer-processor)[inpsyde/logzio-monolog

Logz.io integration for Monolog

191.2M1](/packages/inpsyde-logzio-monolog)[alexandre-daubois/monolog-processor-collection

A collection of Monolog processors

1516.6k](/packages/alexandre-daubois-monolog-processor-collection)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

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