Skip to content

phpwebclient/ext-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Total Downloads License PHP

webclient/ext-redirect

Redirect extension for PSR-18 HTTP client.

Install

Install this package and your favorite psr-18 implementation.

composer require webclient/ext-redirect:^2.0

Using

<?php

use Webclient\Extension\Redirect\RedirectClientDecorator;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;

/** 
 * @var ClientInterface $client Your PSR-18 HTTP Client
 * @var int $maxRedirects Max follow redirects
 */
$http = new RedirectClientDecorator($client, $maxRedirects);

/** @var RequestInterface $request */
$response = $http->sendRequest($request);