class HttpClient implements HttpClientInterface

Http client

Methods

__construct(HttpClientAdapterInterface|null $adapter = null)

Constructor

ResponseInterface
request(string $method, string|UriInterface $uri, array $options = [])

Create and send an http request.

string|null
fetch(string $url, array $options = [])

Fetch url

ResponseInterface
get(string|UriInterface $uri, array $options = [])

Create and send an GET request.

ResponseInterface
head(string|UriInterface $uri, array $options = [])

Create and send an HEAD request.

ResponseInterface
put(string|UriInterface $uri, array $options = [])

Create and send an PUT request.

ResponseInterface
delete(string|UriInterface $uri, array $options = [])

Create and send an DELETE request.

ResponseInterface
post(string|UriInterface $uri, array $options = [])

Create and send an POST request.

ResponseInterface
options(string|UriInterface $uri, array $options = [])

Create and send an OPTIONS request.

ResponseInterface
patch(string|UriInterface $uri, array $options = [])

Create and send an PATCH request.

ResponseInterface
trace(string|UriInterface $uri, array $options = [])

Create and send an TRACE request.

ResponseInterface
connect(string|UriInterface $uri, array $options = [])

Create and send an CONNECT request.

Details

at line 34
__construct(HttpClientAdapterInterface|null $adapter = null)

Constructor

Parameters

HttpClientAdapterInterface|null $adapter

at line 48
ResponseInterface request(string $method, string|UriInterface $uri, array $options = [])

Create and send an http request.

Parameters

string $method
string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 58
HttpClientAdapterInterface getAdapter()

Get adapter

at line 70
string|null fetch(string $url, array $options = [])

Fetch url

Parameters

string $url
array $options

Return Value

string|null

at line 85
ResponseInterface get(string|UriInterface $uri, array $options = [])

Create and send an GET request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 98
ResponseInterface head(string|UriInterface $uri, array $options = [])

Create and send an HEAD request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 111
ResponseInterface put(string|UriInterface $uri, array $options = [])

Create and send an PUT request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 124
ResponseInterface delete(string|UriInterface $uri, array $options = [])

Create and send an DELETE request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 137
ResponseInterface post(string|UriInterface $uri, array $options = [])

Create and send an POST request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 150
ResponseInterface options(string|UriInterface $uri, array $options = [])

Create and send an OPTIONS request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 163
ResponseInterface patch(string|UriInterface $uri, array $options = [])

Create and send an PATCH request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 176
ResponseInterface trace(string|UriInterface $uri, array $options = [])

Create and send an TRACE request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface

at line 189
ResponseInterface connect(string|UriInterface $uri, array $options = [])

Create and send an CONNECT request.

Parameters

string|UriInterface $uri URI object or string.
array $options Request options to apply.

Return Value

ResponseInterface