HttplugClient
in package
implements
HttpClient, HttpAsyncClient, RequestFactory, StreamFactory, UriFactory, ResetInterface
FinalYes
An adapter to turn a Symfony HttpClientInterface into an Httplug client.
Run "composer require nyholm/psr7" to install an efficient implementation of response and stream factories with flex-provided autowiring aliases.
Tags
Table of Contents
Interfaces
- HttpClient
- HttpAsyncClient
- RequestFactory
- StreamFactory
- UriFactory
- ResetInterface
- Provides a way to reset an object to its initial state.
Properties
- $client : mixed
- $promisePool : SplObjectStorage<ResponseInterface, Promise}>|null
- $responseFactory : mixed
- $streamFactory : mixed
- $waitLoop : mixed
Methods
- __construct() : mixed
- __destruct() : mixed
- __sleep() : array<string|int, mixed>
- __wakeup() : mixed
- createRequest() : RequestInterface
- {@inheritdoc}
- createStream() : StreamInterface
- {@inheritdoc}
- createUri() : UriInterface
- {@inheritdoc}
- reset() : mixed
- sendAsyncRequest() : HttplugPromise
- {@inheritdoc}
- sendRequest() : ResponseInterface
- {@inheritdoc}
- wait() : int
- Resolves pending promises that complete before the timeouts are reached.
- sendPsr7Request() : ResponseInterface
Properties
$client
private
mixed
$client
$promisePool
private
SplObjectStorage<ResponseInterface, Promise}>|null
$promisePool
$responseFactory
private
mixed
$responseFactory
$streamFactory
private
mixed
$streamFactory
$waitLoop
private
mixed
$waitLoop
Methods
__construct()
public
__construct([HttpClientInterface|null $client = null ][, ResponseFactoryInterface|null $responseFactory = null ][, StreamFactoryInterface|null $streamFactory = null ]) : mixed
Parameters
- $client : HttpClientInterface|null = null
- $responseFactory : ResponseFactoryInterface|null = null
- $streamFactory : StreamFactoryInterface|null = null
__destruct()
public
__destruct() : mixed
__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__wakeup()
public
__wakeup() : mixed
createRequest()
{@inheritdoc}
public
createRequest(mixed $method, mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ][, mixed $protocolVersion = '1.1' ]) : RequestInterface
Parameters
- $method : mixed
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
- $protocolVersion : mixed = '1.1'
Return values
RequestInterfacecreateStream()
{@inheritdoc}
public
createStream([mixed $body = null ]) : StreamInterface
Parameters
- $body : mixed = null
Return values
StreamInterfacecreateUri()
{@inheritdoc}
public
createUri(mixed $uri) : UriInterface
Parameters
- $uri : mixed
Return values
UriInterfacereset()
public
reset() : mixed
sendAsyncRequest()
{@inheritdoc}
public
sendAsyncRequest(RequestInterface $request) : HttplugPromise
Parameters
- $request : RequestInterface
Return values
HttplugPromisesendRequest()
{@inheritdoc}
public
sendRequest(RequestInterface $request) : ResponseInterface
Parameters
- $request : RequestInterface
Return values
ResponseInterfacewait()
Resolves pending promises that complete before the timeouts are reached.
public
wait([float|null $maxDuration = null ][, float|null $idleTimeout = null ]) : int
When $maxDuration is null and $idleTimeout is reached, promises are rejected.
Parameters
- $maxDuration : float|null = null
- $idleTimeout : float|null = null
Return values
int —The number of remaining pending promises
sendPsr7Request()
private
sendPsr7Request(RequestInterface $request[, bool|null $buffer = null ]) : ResponseInterface
Parameters
- $request : RequestInterface
- $buffer : bool|null = null