UriTemplateHttpClient
in package
implements
HttpClientInterface, ResetInterface
uses
DecoratorTrait
Table of Contents
Interfaces
- HttpClientInterface
- Provides flexible methods for requesting HTTP resources synchronously or asynchronously.
- ResetInterface
- Provides a way to reset an object to its initial state.
Properties
- $client : HttpClientInterface
- $defaultVars : array<string|int, mixed>
- $expander : Closure|null
Methods
- __construct() : mixed
- request() : ResponseInterface
- Requests an HTTP resource.
- reset() : void
- stream() : ResponseStreamInterface
- withOptions() : static
- Returns a new instance of the client with new default options.
- createExpanderFromPopularVendors() : callable(string $url, array<string|int, mixed> $vars): string
Properties
$client
private
HttpClientInterface
$client
$defaultVars
private
array<string|int, mixed>
$defaultVars
= []
$expander
private
Closure|null
$expander
= null
Methods
__construct()
public
__construct([HttpClientInterface|null $client = null ][, callable(string $url, array<string|int, mixed> $vars): string|null $expander = null ][, array<string|int, mixed> $defaultVars = [] ]) : mixed
Parameters
- $client : HttpClientInterface|null = null
- $expander : callable(string $url, array<string|int, mixed> $vars): string|null = null
- $defaultVars : array<string|int, mixed> = []
request()
Requests an HTTP resource.
public
request(string $method, string $url[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Responses MUST be lazy, but their status code MUST be checked even if none of their public methods are called.
Implementations are not required to support all options described above; they can also support more custom options; but in any case, they MUST throw a TransportExceptionInterface when an unsupported option is passed.
Parameters
- $method : string
- $url : string
- $options : array<string|int, mixed> = []
Return values
ResponseInterfacereset()
public
reset() : void
stream()
public
stream(ResponseInterface|iterable<string|int, mixed> $responses[, float|null $timeout = null ]) : ResponseStreamInterface
Parameters
- $responses : ResponseInterface|iterable<string|int, mixed>
- $timeout : float|null = null
Return values
ResponseStreamInterfacewithOptions()
Returns a new instance of the client with new default options.
public
withOptions(array<string|int, mixed> $options) : static
Parameters
- $options : array<string|int, mixed>
Return values
staticcreateExpanderFromPopularVendors()
private
createExpanderFromPopularVendors() : callable(string $url, array<string|int, mixed> $vars): string