HttpClient
in package
FinalYes
A factory to instantiate the best possible HTTP client for the runtime.
Tags
Table of Contents
Methods
- create() : HttpClientInterface
- createForBaseUri() : HttpClientInterface
- Creates a client that adds options (e.g. authentication headers) only when the request URL matches the provided base URI.
Methods
create()
public
static create([array<string|int, mixed> $defaultOptions = [] ][, int $maxHostConnections = 6 ][, int $maxPendingPushes = 50 ]) : HttpClientInterface
Parameters
- $defaultOptions : array<string|int, mixed> = []
-
Default request's options
- $maxHostConnections : int = 6
-
The maximum number of connections to a single host
- $maxPendingPushes : int = 50
-
The maximum number of pushed responses to accept in the queue
Tags
Return values
HttpClientInterfacecreateForBaseUri()
Creates a client that adds options (e.g. authentication headers) only when the request URL matches the provided base URI.
public
static createForBaseUri(string $baseUri[, array<string|int, mixed> $defaultOptions = [] ][, int $maxHostConnections = 6 ][, int $maxPendingPushes = 50 ]) : HttpClientInterface
Parameters
- $baseUri : string
- $defaultOptions : array<string|int, mixed> = []
- $maxHostConnections : int = 6
- $maxPendingPushes : int = 50