RestClient
in package
RestClient.
Tags
Table of Contents
Methods
- __construct() : mixed
- RestClient constructor.
- customHttpRequest() : ResponseInterface
- Makes a custom HTTP request.
- delete() : ResponseInterface
- Performs a DELETE request.
- get() : ResponseInterface
- Performs a GET request.
- patch() : ResponseInterface
- Performs a PATCH request
- post() : ResponseInterface
- Performs a POST request.
- put() : mixed|ResponseInterface
- Performs a PUT request.
Methods
__construct()
RestClient constructor.
public
__construct(string $baseUri[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $baseUri : string
-
Base URI for all requests.
- $options : array<string|int, mixed> = []
-
Base options for all requests.
Tags
customHttpRequest()
Makes a custom HTTP request.
public
customHttpRequest(string $method, string $url[, string $body = "" ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $method : string
-
HTTP method to use.
- $url : string
-
URL to request.
- $body : string = ""
-
Body to be sent.
- $headers : array<string|int, mixed> = []
-
Additional headers.
Tags
Return values
ResponseInterfacedelete()
Performs a DELETE request.
public
delete(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $url : string
-
URL to execute request.
- $data : mixed = []
-
Data to send.
- $headers : array<string|int, mixed> = []
-
Additional headers.
Tags
Return values
ResponseInterfaceget()
Performs a GET request.
public
get(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $url : string
-
URL to execute request.
- $data : mixed = []
-
Data to send.
- $headers : array<string|int, mixed> = []
-
Additional headers.
Tags
Return values
ResponseInterfacepatch()
Performs a PATCH request
public
patch(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $url : string
-
URL to execute request
- $data : mixed = []
-
Data to send
- $headers : array<string|int, mixed> = []
-
Additional headers.
Tags
Return values
ResponseInterfacepost()
Performs a POST request.
public
post(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $url : string
-
URL to execute request.
- $data : mixed = []
-
Data to send.
- $headers : array<string|int, mixed> = []
-
Additional headers.
Tags
Return values
ResponseInterfaceput()
Performs a PUT request.
public
put(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : mixed|ResponseInterface
Parameters
- $url : string
-
URL to execute request.
- $data : mixed = []
-
Data to send.
- $headers : array<string|int, mixed> = []
-
Additional headers.