2017 © Pedro Peláez
 

library request-id

PHP middleware to add a Request ID header

image

los/request-id

PHP middleware to add a Request ID header

  • Friday, March 16, 2018
  • by Lansoweb
  • Repository
  • 2 Watchers
  • 2 Stars
  • 5,124 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 17 % Grown

The README.md

Request ID Middleware for PHP

This middleware adds a Request ID header that can be used to trace back requests (logs)., (*1)

It uses [Ramsey\Uuidhttps://github.com/ramsey/uuid) library to uuid generation.https://github.com/ramsey/uuid) library to uuid generation., (*2)

Usage

Just add the middleware as one of the first in your application., (*3)

For example:, (*4)

$app->pipe(new \LosMiddleware\RequestId\RequestId($options);

And the middleware will add a header to the request AND response, (*5)

X-Request-Id: 56CEE969-4D3B-404E-9938-03E769E191CB

The options are: * uuid_version: Uuid version to be used. Default: 4 * uuid_ns: Nameserver to be used by uuid versions 3 or 5. Default: null * uuid_name: Name to be used by uuid versions 3 or 5. Default: null * allow_override: If it's allowed to override a previouly added request id header. Default: false * header_name: Header name. Default: X-Request-Id, (*6)

Zend Expressive

If you are using expressive-skeleton, you can copy config/los-request-id.global.php.dist to config/autoload/los-request-id.global.php and modify configuration as your needs., (*7)

The Versions

12/10 2016

1.0.0

1.0.0.0 https://github.com/lansoweb/request-id

PHP middleware to add a Request ID header

  Sources   Download

MIT

The Requires