PHP code example of mxnwire / laravel-request-id

1. Go to this page and download the library: Download mxnwire/laravel-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/ */

    

mxnwire / laravel-request-id example snippets


Route::middleware('request-id')->group(function () {
    // ...
});

$requestId = $request->attributes->get('x_request_id');

use Monolog\Formatter\JsonFormatter;

'requests' => [
    'driver'    => 'daily',
    'path'      => storage_path('logs/requests.log'),
    'formatter' => JsonFormatter::class,
    'days'      => 14,
],