From 2bbf609dd8d4bb1a845796b3e8bc3342b416eb8d Mon Sep 17 00:00:00 2001 From: Jose Manuel Cardona Date: Fri, 25 Jun 2021 12:52:00 +0200 Subject: [PATCH 1/4] Upgrade dependencies --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 6099e0e..ab7f2a7 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ "license": "Apache-2.0", "type": "library", "require": { - "php": ">=7.0", - "illuminate/http": "^5.3", + "php": ">=7.4", + "illuminate/http": ">7.0", "ramsey/uuid": "^3.5" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { From edb04b09afc1e63e49fcda3f64f196f39678a871 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cardona Date: Fri, 25 Jun 2021 13:05:40 +0200 Subject: [PATCH 2/4] Upgrade ramsey uuid --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ab7f2a7..8807f27 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": ">=7.4", "illuminate/http": ">7.0", - "ramsey/uuid": "^3.5" + "ramsey/uuid": "^4.0.0" }, "require-dev": { "phpunit/phpunit": "^9.0" From b4405c96ac044a8339a6959860c54c6883595515 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cardona Date: Fri, 25 Jun 2021 13:20:15 +0200 Subject: [PATCH 3/4] Add extra instructions to allow to set the X_REQUEST_ID during booting time --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c70d76d..2eba2bb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add `Softonic\Laravel\Middleware\RequestId::class` in `App\Http\Kernel`. For all routes: ```php protected $middleware = [ - Softonic\Laravel\Middleware\RequestId::class, + \Softonic\Laravel\Middleware\RequestId::class, .... ] ``` @@ -26,7 +26,7 @@ Specific group: // Example for WEB group protected $middlewareGroups = [ 'web' => [ - Softonic\Laravel\Middleware\RequestId::class, + \Softonic\Laravel\Middleware\RequestId::class, ... ], @@ -49,4 +49,9 @@ Register the middleware as a route middleware in `App\Http\Kernel`. then, use it in your routes file, for example in `routes\web.php` ```php Route::get('route', function() {})->middleware('request-id'); -``` \ No newline at end of file +``` + +### Extra + +If you need to have the X-Request-Id ASAP, you can modify `\App\Providers\AppServiceProvider::boot` adding `$_SERVER['HTTP_X_REQUEST_ID'] ??= \Ramsey\Uuid\Uuid::uuid4()->toString();`. +This is going to allow you to use the X-Request-ID in the framework booting to for example customize monolog. From d1b3e633c10c1f4cc3fc3b11160efba2f72caa95 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cardona Date: Fri, 25 Jun 2021 13:34:40 +0200 Subject: [PATCH 4/4] Fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2eba2bb..a4f1c87 100644 --- a/README.md +++ b/README.md @@ -54,4 +54,4 @@ Route::get('route', function() {})->middleware('request-id'); ### Extra If you need to have the X-Request-Id ASAP, you can modify `\App\Providers\AppServiceProvider::boot` adding `$_SERVER['HTTP_X_REQUEST_ID'] ??= \Ramsey\Uuid\Uuid::uuid4()->toString();`. -This is going to allow you to use the X-Request-ID in the framework booting to for example customize monolog. +This is going to allow you to use the X-Request-ID in the framework booting to for example customize monolog or in console executions.