PHP code example of keerill / laravel-http-client-logger

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

    

keerill / laravel-http-client-logger example snippets


use Psr\Log\LoggerInterface;

/** @var LoggerInterface $logger */
$logger = logger();

$response = Http::baseUrl('http://microservice/api/v1')
        ->withMiddleware(new HttpLoggerMiddleware($logger, new ContextFormatter()))
        ->post('/healthcheck', ['test' => 'message'])
        ->json();

// ...