PHPackages                             oat-sa/lib-correlation-ids - 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. oat-sa/lib-correlation-ids

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

oat-sa/lib-correlation-ids
==========================

OAT Correlation Ids Library

v0.4.0(1y ago)09.6k↓74.3%12GPL-2.0-onlyPHPPHP ^7.1.3 || ^8.0CI failing

Since Nov 5Pushed 1y ago40 watchersCompare

[ Source](https://github.com/oat-sa/lib-correlation-ids)[ Packagist](https://packagist.org/packages/oat-sa/lib-correlation-ids)[ RSS](/packages/oat-sa-lib-correlation-ids/feed)WikiDiscussions master Synced yesterday

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

Correlation Ids Library
=======================

[](#correlation-ids-library)

> PHP library for correlation ids management.

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Principles](#principles)
- [Usage](#usage)
- [Tests](#tests)

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

[](#installation)

```
$ composer require oat-sa/lib-correlation-ids
```

Principles
----------

[](#principles)

This library provides an [interface](./src/Registry/CorrelationIdsRegistryInterface.php) that will allow access to 3 kind of correlation ids:

- `getCurrentCorrelationId()`: for the current application process.
- `getParentCorrelationId()`: for the parent application that calls your application, if any.
- `getRootCorrelationId()`: for the root application from which all the calls originate in the first place.

Example:

```
 Request
    |
    v
+---------------+  current: xxx
| Application A |  parent: NULL
+---+-----------+  root: NULL
    |
    v
+---------------+  current: yyy
| Application B |  parent: xxx
+---+-----------+  root: xxx
    |
    v
+---------------+  current: zzz
| Application C |  parent: yyy
+---------------+  root: xxx

```

Usage
-----

[](#usage)

### From HTTP context

[](#from-http-context)

```
