PHP code example of bellissimopizza / bellissimo-log

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

    

bellissimopizza / bellissimo-log example snippets


 public function boot(): void
    {
        // Generate unique identifier for this request-response cycle
        $request = request();
        $requestId = Str::uuid()->toString();

        $request->attributes->add(['X-Request-ID' => $requestId]);
    }

    use App\Utils\Log\RouteLogMiddleware;


    Route::post('orders', [OrderController::class, 'store'])->middleware(RouteLogMiddleware::class);

  use App\Utils\Log\GuzzleLogMiddleware;


  Http::baseUrl('https://dummyjson.com')
    ->withHeaders([
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ])
    ->withMiddleware(new GuzzleLogMiddleware())
      ->get("/products/1")->json();