Download the PHP package chrisguitarguy/request-id-bundle without Composer
On this page you can find all versions of the php package chrisguitarguy/request-id-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chrisguitarguy/request-id-bundle
More information about chrisguitarguy/request-id-bundle
Files in chrisguitarguy/request-id-bundle
Package request-id-bundle
Short Description Add request IDs to to your Symfony requests.
License MIT
Informations about the package request-id-bundle
Request ID Bundle
This adds request ID's to your Symfony application. Why? It's a great way to add some additional information to logs and to present to users. For example, if an exception is thrown you'll be able to show the user the request ID which they can pass on to you to locate their specific issue.
Installation
Use Composer.
Then enable the bundle in your AppKernel
.
Configuration
How it Works
When a request comes in, it's inspected for the Request-Id
header. If present,
the value in that header will be used throughout the rest of the bundle. This
lets you use request ID's from somewhere higher up in the stack (like in the web
server itself).
If no request ID is found, one is generated by the RequestIdGenerator
. The
default generator creates version 4 UUIDs.
On the way out out, the Request-Id
header is set on the response as well using
the value described above.
The headers are configurable. See the configuration above.
Monolog Integration
There's a monolog Processor that adds the request ID to extra
array on the
record. This can be turned off by setting enable_monolog
to false
in the
configuration.
To use the request ID in your logs, include %extra.request_id%
in your
formatter. Here's a configuration example from this bundle's tests.
Twig Integration
Important: Twig ^2.7 or ^3.0 is required for the twig integration to work.
By default this bundle will add a global request_id
function to your twig
environment. To disable this set enable_twig
to false
in the bundle
configuration.
Here's an example of a template.
License
MIT. See the LICENSE file.
All versions of request-id-bundle with dependencies
symfony/framework-bundle Version ^5.4 || ^6.0 || ^7.0
ramsey/uuid Version ^3.9 || ^4.3