Download the PHP package mdavid-dev/symfony-correlation-id-bundle without Composer

On this page you can find all versions of the php package mdavid-dev/symfony-correlation-id-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-correlation-id-bundle

Symfony Correlation ID Bundle

A Symfony bundle to automatically manage correlation IDs across HTTP requests and responses, making it easy to trace and debug your application.

Features

Installation

1. Install via Composer

2. Enable the Bundle

3. That's it!

The bundle works out-of-the-box with default configuration.

Quick Start

Once installed, the bundle automatically:

  1. Reads the X-Correlation-ID header from incoming requests
  2. Generates a UUID v4 if the header is missing
  3. Adds the correlation ID to all response headers

Example Request:

Example Response:

Configuration

Default Configuration

Validation & Security

By default, the bundle validates correlation IDs to prevent malicious input:

Security features:

Customize the pattern for your needs:

UUID v4 only (strictest)

Allow more characters

Disable pattern validation (not recommended)

Configuration Examples

Custom Header Name

Disable Trust Header Always generate a new ID, ignoring incoming headers:

Enable Monolog Integration

Automatically add correlation ID to all logs:

Disable Monolog integration:

Usage in Your Application

Access the Correlation ID

Inject the CorrelationIdStorage service:

Available Methods

Monolog Integration

Automatic Logging

When Monolog integration is enabled (default), the correlation ID is automatically added to all log entries in the extra field. Example log output:

Custom Log Key

Change the key name used in logs:

Requirements

Monolog integration requires the monolog/monolog package:

If Monolog is not installed, the integration is automatically disabled.

CLI Integration

When CLI integration is enabled (default), the bundle manages correlation IDs for Symfony Console commands.

Environment Variable

If cli.allow_env_var is true (default), you can pass a correlation ID via the CORRELATION_ID environment variable:

This is particularly useful when executing commands from a Process within an HTTP request context:

Automatic ID Generation

If no environment variable is provided, an ID is automatically generated using the configured generator and prefixed with cli.prefix (default: CLI-):

Example output for a generated ID: CLI-550e8400-e29b-41d4-a716-446655440000

Access in Commands

You can access the ID in your commands just like in controllers:

Advanced Usage

Custom ID Generator

Create your own generator:

Configure it:

Testing

Requirements

License

This bundle is released under the MIT License.

Contributing

Contributions are welcome! Please submit a Pull Request.


All versions of symfony-correlation-id-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/config Version ^6.4|^7.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/http-foundation Version ^6.4|^7.0
symfony/http-kernel Version ^6.4|^7.0
symfony/uid Version ^6.4|^7.0
symfony/yaml Version ^6.4|^7.0
symfony/console Version ^6.4|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mdavid-dev/symfony-correlation-id-bundle contains the following files

Loading the files please wait ...