HttpClient
in package
implements
HttpClientInterface
Http client
Table of Contents
Interfaces
- HttpClientInterface
- Http Client Interface
Properties
- $adapter : HttpClientAdapterInterface
- Adapter
Methods
- __construct() : mixed
- Constructor
- connect() : ResponseInterface
- Create and send an CONNECT request.
- delete() : ResponseInterface
- Create and send an DELETE request.
- fetch() : mixed|null
- Fetch url
- get() : ResponseInterface
- Create and send an GET request.
- getAdapter() : HttpClientAdapterInterface
- Get adapter
- head() : ResponseInterface
- Create and send an HEAD request.
- options() : ResponseInterface
- Create and send an OPTIONS request.
- patch() : ResponseInterface
- Create and send an PATCH request.
- post() : ResponseInterface
- Create and send an POST request.
- put() : ResponseInterface
- Create and send an PUT request.
- request() : ResponseInterface
- Create and send an http request.
- toArray() : array<string|int, mixed>|null
- Convert reponse to array
- trace() : ResponseInterface
- Create and send an TRACE request.
Properties
$adapter
Adapter
private
HttpClientAdapterInterface
$adapter
Methods
__construct()
Constructor
public
__construct([HttpClientAdapterInterface|null $adapter = null ]) : mixed
Parameters
- $adapter : HttpClientAdapterInterface|null = null
connect()
Create and send an CONNECT request.
public
connect(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacedelete()
Create and send an DELETE request.
public
delete(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacefetch()
Fetch url
public
fetch(string|UriInterface $url[, array<string|int, mixed> $options = [] ]) : mixed|null
Parameters
- $url : string|UriInterface
- $options : array<string|int, mixed> = []
Return values
mixed|nullget()
Create and send an GET request.
public
get(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacegetAdapter()
Get adapter
public
getAdapter() : HttpClientAdapterInterface
Return values
HttpClientAdapterInterfacehead()
Create and send an HEAD request.
public
head(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfaceoptions()
Create and send an OPTIONS request.
public
options(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacepatch()
Create and send an PATCH request.
public
patch(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacepost()
Create and send an POST request.
public
post(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfaceput()
Create and send an PUT request.
public
put(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacerequest()
Create and send an http request.
public
request(string $method, string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $method : string
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.
Return values
ResponseInterfacetoArray()
Convert reponse to array
public
toArray(mixed $response) : array<string|int, mixed>|null
Parameters
- $response : mixed
Tags
Return values
array<string|int, mixed>|nulltrace()
Create and send an TRACE request.
public
trace(string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
URI object or string.
- $options : array<string|int, mixed> = []
-
Request options to apply.