Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbsedv/request-id-bundle
A Symfony bundle that adds a unique Request-ID.
https://github.com/sbsedv/request-id-bundle
logging php php8 request-id symfony symfony-bundle
Last synced: 11 days ago
JSON representation
A Symfony bundle that adds a unique Request-ID.
- Host: GitHub
- URL: https://github.com/sbsedv/request-id-bundle
- Owner: SBSEDV
- License: mit
- Created: 2022-05-16T14:23:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-01T15:47:01.000Z (12 months ago)
- Last Synced: 2023-12-02T16:36:52.072Z (12 months ago)
- Topics: logging, php, php8, request-id, symfony, symfony-bundle
- Language: PHP
- Homepage:
- Size: 130 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![PHPStan](https://github.com/SBSEDV/request-id-bundle/actions/workflows/phpstan.yml/badge.svg)](https://github.com/SBSEDV/request-id-bundle/actions/workflows/phpstan.yml)
[![PHPCS-Fixer](https://github.com/SBSEDV/request-id-bundle/actions/workflows/phpcsfixer.yml/badge.svg)](https://github.com/SBSEDV/request-id-bundle/actions/workflows/phpcsfixer.yml)# sbsedv/request-id-bundle
A Symfony bundle that adds a unique Request-ID.
In the configuration examples shown below, the default values are used.
---
The generic configuration is as follows:
```yaml
# config/packages/sbsedv_request_id.yamlsbsedv_request_id:
generator: "SBSEDV\Bundle\RequestIdBundle\Generator\UuidRequestIdGenerator"
# generator: "SBSEDV\Bundle\RequestIdBundle\Generator\RequestIdGenerator"
# generator: 'your_custom_service_id' (must implement RequestIdGeneratorInterface)outgoing_http_header: "x-request-id" # http header that will be added
# outgoing_http_header: false # disables the header creationincoming_http_header: false # disabled
# incoming_http_header: "x-request-id" # request header that contains the Request-ID to use
```The incoming http-header is only used when the `SBSEDV\Bundle\RequestIdBundle\TrustStrategy\TrustStrategyInterface` service trusts the incoming request.
By default the [PrivateIpTrustStrategy](src/TrustStrategy/PrivateIpTrustStrategy.php) is registered.---
### **Twig Integration**
If your application has the [symfony/twig-bundle](https://github.com/symfony/twig-bundle) installed, the `request_id` twig function is registered.
```twig
{# templates/example.html.twig #}Request-ID: {{ request_id() }}
```You can customize the registered twig function name via:
```yaml
# config/packages/sbsedv_request_id.yamlsbsedv_request_id:
twig_function_name: "request_id"
```---
### **Error Renderer**
By default this bundle decorates the `error_renderer` service and inserts the current request id before the `