HttpMethodsClient
in package
implements
HttpMethodsClientInterface
FinalYes
Table of Contents
Interfaces
- HttpMethodsClientInterface
- Convenience HTTP client that integrates the MessageFactory in order to send requests in the following form:.
Properties
- $httpClient : ClientInterface
- $requestFactory : RequestFactory|RequestFactoryInterface
- $streamFactory : StreamFactoryInterface|null
Methods
- __construct() : mixed
- delete() : ResponseInterface
- Sends a DELETE request.
- get() : ResponseInterface
- Sends a GET request.
- head() : ResponseInterface
- Sends an HEAD request.
- options() : ResponseInterface
- Sends an OPTIONS request.
- patch() : ResponseInterface
- Sends a PATCH request.
- post() : ResponseInterface
- Sends a POST request.
- put() : ResponseInterface
- Sends a PUT request.
- send() : ResponseInterface
- Sends a request with any HTTP method.
- sendRequest() : ResponseInterface
- Sends a PSR-7 request and returns a PSR-7 response.
- trace() : ResponseInterface
- Sends a TRACE request.
- createRequest() : RequestInterface
Properties
$httpClient
private
ClientInterface
$httpClient
$requestFactory
private
RequestFactory|RequestFactoryInterface
$requestFactory
$streamFactory
private
StreamFactoryInterface|null
$streamFactory
Methods
__construct()
public
__construct(ClientInterface $httpClient, RequestFactory|RequestFactoryInterface $requestFactory[, StreamFactoryInterface $streamFactory = null ]) : mixed
Parameters
- $httpClient : ClientInterface
- $requestFactory : RequestFactory|RequestFactoryInterface
- $streamFactory : StreamFactoryInterface = null
delete()
Sends a DELETE request.
public
delete(mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
Return values
ResponseInterfaceget()
Sends a GET request.
public
get(mixed $uri[, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
Return values
ResponseInterfacehead()
Sends an HEAD request.
public
head(mixed $uri[, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
Return values
ResponseInterfaceoptions()
Sends an OPTIONS request.
public
options(mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
Return values
ResponseInterfacepatch()
Sends a PATCH request.
public
patch(mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
Return values
ResponseInterfacepost()
Sends a POST request.
public
post(mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
Return values
ResponseInterfaceput()
Sends a PUT request.
public
put(mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
Return values
ResponseInterfacesend()
Sends a request with any HTTP method.
public
send(string $method, mixed $uri[, array<string|int, mixed> $headers = [] ][, mixed $body = null ]) : ResponseInterface
Parameters
- $method : string
-
HTTP method to use
- $uri : mixed
- $headers : array<string|int, mixed> = []
- $body : mixed = null
Return values
ResponseInterfacesendRequest()
Sends a PSR-7 request and returns a PSR-7 response.
public
sendRequest(RequestInterface $request) : ResponseInterface
Parameters
- $request : RequestInterface
Return values
ResponseInterfacetrace()
Sends a TRACE request.
public
trace(mixed $uri[, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $uri : mixed
- $headers : array<string|int, mixed> = []
Return values
ResponseInterfacecreateRequest()
private
createRequest(string $method, string|UriInterface $uri[, array<string|int, mixed> $headers = [] ][, string|StreamInterface|null $body = null ]) : RequestInterface
Parameters
- $method : string
- $uri : string|UriInterface
- $headers : array<string|int, mixed> = []
- $body : string|StreamInterface|null = null