proemergotech / correlate-php-core by shakahl

Core interface package for correlate id generation for microservices writen in PHP.
7,074
0
3
Package Data
Maintainer Username: shakahl
Maintainer Contact: support@proemergotech.com (ProEmergotech Kft)
Package Create Date: 2017-06-15
Package Last Update: 2017-10-11
Language: PHP
License: MIT
Last Refreshed: 2024-10-09 03:01:48
Package Statistics
Total Downloads: 7,074
Monthly Downloads: 6
Daily Downloads: 0
Total Stars: 0
Total Watchers: 3
Total Forks: 0
Total Open Issues: 0

correlate-php-core


Overview

It's very difficult to track a request accross the system when we are working with microservices. We came out a solution for that. We generate a unique version 4 uuid for every request and every service passes this id via request header to other services. We call this correlation ID.

Packages

Installation

You should not use this directly.

By the way if you want to use it directly, you can install it via composer.

$ composer require proemergotech/correlate-php-core

Defaults

Default header name is X-Correlation-ID and default parameter name is x_correlation_id.

Usage

Generate a correlation id:

\ProEmergotech\Correlate\Correlate\Correlate::id();

Other methods:

\ProEmergotech\Correlate\Correlate::getHeaderName();
\ProEmergotech\Correlate\Correlate::getParamName();
\ProEmergotech\Correlate\Correlate::getGeneratorFunc();

// You can override defaults...
\ProEmergotech\Correlate\Correlate::setHeaderName('X-My-Correlation-ID');
\ProEmergotech\Correlate\Correlate::setParamName('my_correlation_id');
\ProEmergotech\Correlate\Correlate::setGeneratorFunc(function(){
  return uniqid();
});

Contributing

See CONTRIBUTING.md file.

Credits

This package developed by Soma Szélpál at Pro Emergotech Ltd..

License

This project is released under the MIT License.