dezento/effective-url-middleware

Guzzle 7 Effective Url Solution

1.0 2021-05-20 18:44 UTC

This package is auto-updated.

Last update: 2024-05-21 01:37:57 UTC


README

A quick solution for Guzzle 7 to get the request URL from the response.

Instalation

Install via composer

 composer require dezento/effective-url-middleware

Usage

require "vendor/autoload.php";

use Dezento\EffectiveUrlMiddleware;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Client;

$stack = HandlerStack::create();
$stack->push(EffectiveUrlMiddleware::middleware());

$client = new Client([
    'handler' => $stack
]);

$response = $client->request('GET', 'http://httpbin.org/get');

echo $response->getHeaderLine('X-GUZZLE-EFFECTIVE-URL');