Download the PHP package xepozz/request-id without Composer
On this page you can find all versions of the php package xepozz/request-id. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xepozz/request-id
More information about xepozz/request-id
Files in xepozz/request-id
Package request-id
Short Description Tracing request and response IDs for Yii 3
License
Informations about the package request-id
Request ID
This is a simple library to generate both unique request and response IDs for tracing purposes.
Installation
Usage
Add the middleware to your application configuration, e.g. config/web/params.php
:
Note: The middleware must be added before the
ErrorCatcher
middleware if you want to see the response ID in the error page.
Request ID Provider
You can get the request ID with the Xepozz\RequestID\RequestIDProviderInterface
interface:
Configuration
Using incoming request ID
If you want not to use the Request ID from the incoming request, you can disable this behavior by specifying the useIncomingRequestID
parameter in the application configuration:
Note: By default, the library always uses the header to get the request ID from the incoming request.
Request ID header
By default, the library uses the X-Request-ID
header to store the request ID. Same header name is used to set response ID.
You can change the header name by specifying the headerName
parameter in the application configuration:
Response ID header
By default, the library sets the header to the response at the end of a request.
You can disable this behavior by specifying the setResponseHeader
parameter in the application configuration:
Strategies
By default, the library uses the Xepozz\RequestID\UuidGenerator
generator.
You can change the strategy by specifying the implementation of the Xepozz\RequestID\RequestIDGeneratorInterface
interface in the container:
Looking for more modules?
- Unique ID - Allows you to track the unique user in the application.
- AB - A simple library to enable A/B testing based on a set of rules.
- Feature Flag - A simple library to enable/disable features based on a set of rules.
- Shortcut - Sets of helper functions for rapid development of Yii 3 applications.