PHP code example of eonx-com / easy-request-id
1. Go to this page and download the library: Download eonx-com/easy-request-id library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eonx-com / easy-request-id example snippets
// src/Controller/MyController.php
namespace App\Controller;
use EonX\EasyRequestId\Common\Provider\RequestIdProviderInterface;
final class MyController
{
public function __construct(private RequestIdProviderInterface $requestIdProvider)
{
}
public function __invoke()
{
$requestId = $this->requestIdProvider->getRequestId();
$correlationId = $this->requestIdProvider->getCorrelationId();
// Use the IDs in your logic...
}
}