GuzzleHandler
in package
A request handler that sends PSR-7-compatible requests with Guzzle 5.
The handler accepts a PSR-7 Request object and an array of transfer options and returns a Guzzle 6 Promise. The promise is either resolved with a PSR-7 Response object or rejected with an array of error data.
Tags
Table of Contents
- $client : ClientInterface
- $validOptions : mixed
- __construct() : mixed
- __invoke() : Promise|PromiseInterface
- createGuzzleRequest() : mixed
- createPsr7Response() : mixed
- prepareErrorData() : mixed
Properties
$client
private
ClientInterface
$client
$validOptions
private
static mixed
$validOptions
= ['proxy' => true, 'expect' => true, 'cert' => true, 'verify' => true, 'timeout' => true, 'debug' => true, 'connect_timeout' => true, 'stream' => true, 'delay' => true, 'sink' => true]
Methods
__construct()
public
__construct([ClientInterface $client = null ]) : mixed
Parameters
- $client : ClientInterface = null
Return values
mixed —__invoke()
public
__invoke(RequestInterface $request[, array<string|int, mixed> $options = [] ]) : Promise|PromiseInterface
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed> = []
Tags
Return values
Promise|PromiseInterface —createGuzzleRequest()
private
createGuzzleRequest(RequestInterface $psrRequest, array<string|int, mixed> $options) : mixed
Parameters
- $psrRequest : RequestInterface
- $options : array<string|int, mixed>
Return values
mixed —createPsr7Response()
private
createPsr7Response(ResponseInterface $response) : mixed
Parameters
- $response : ResponseInterface
Return values
mixed —prepareErrorData()
private
prepareErrorData(Exception $e) : mixed
Parameters
- $e : Exception