Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2025-02-20 (Yesterday) ![]() | Not yet rated by the users | Total: Not yet counted | Not yet ranked |
Version | License | PHP version | Categories | |||
laravel-correlation 1.0 | MIT/X Consortium ... | 8 | HTTP, Libraries, PHP 8 |
Description | Author | |
This package can generate a correlation identifier. |
|
A package to manage correlation IDs for request tracing in Laravel applications.
A correlation ID is a unique identifier assigned to each request entering a distributed system. It helps developers trace requests, debug issues, and identify potential security threats. By attaching a correlation ID to each request, you can track its journey through various services and components, simplifying troubleshooting and monitoring.
composer require mohamedahmed01/laravel-correlation
php artisan vendor:publish --tag=correlation-config
config/correlation.php
)header
: Header name to use (default: `X-Correlation-ID`)
alternate_headers
: Additional headers to check for a correlation ID (e.g., `X-Request-ID`, `Trace-ID`)
generator
: Strategy for generating correlation IDs (`uuid`, `timestamp`, `hash`)
storage
: Store correlation IDs in `cache`, `session`, or `none`
queue
: Enable correlation ID propagation in queued jobs (default: `true`)
propagate
: Automatically include correlation ID in outgoing HTTP requests (default: `true`)
auto_register_middleware
: Automatically register middleware (default: `true`)
The correlation ID will be:
If auto_register_middleware
is disabled, manually register the middleware in app/Http/Kernel.php
:
protected $middleware = [
\Mohamedahmed01\LaravelCorrelation\Http\Middleware\CorrelationMiddleware::class,
];
$correlationId = correlation_id();
@correlationId
public function handle()
{
$correlationId = correlation_id();
Log::info("Processing job", ['correlation_id' => $correlationId]);
}
All logs during a request will automatically include the correlation ID:
{
"message": "User created",
"context": {
"correlation_id": "123e4567-e89b-12d3-a456-426614174000"
}
}
If propagate
is enabled, correlation IDs will be automatically included in outgoing HTTP requests:
$response = Http::withCorrelationId()->get('https://api.example.com/data');
List stored correlation IDs:
php artisan correlation:list
Run the test suite to ensure functionality:
php artisan test
MIT License
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | |||||||
100% |
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.