PHP code example of trin4ik / laravel-http-after

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

    

trin4ik / laravel-http-after example snippets



// bootstrap/app.php

$app->register(Trin4ik\LaravelHttpAfter\LaravelHttpAfterServiceProvider::class);

// If you want to use the Facades provided by the package
$app->withFacades();

use GuzzleHttp\Psr7\Message;
use Illuminate\Support\Facades\Http;

Http::after(function ($request, $response, $time) {
    echo "time: " . $time . PHP_EOL;
    echo "request:" . PHP_EOL . Message::toString($request) . PHP_EOL;
    echo "response:" . PHP_EOL . Message::toString($response) . PHP_EOL;
})->get('https://example.com');