$_BASE_URL
$_BASE_URL : String
The base path of the API. All other API paths will be used relative to this
Communique Pluggable REST Client
$_http : \Communique\HTTPClient
An implementation of \Communique\HTTPClient
__construct(String $base_url = '', array $interceptors = array(), \Communique\HTTPClient $http_client = null)
Constructs Communique REST library.
String | $base_url | The base URL of the API you wish to make requests to. All other paths referenced will be treated as relative to this. |
array | $interceptors | An array of any interceptors you wish to use to modify the request. An interceptor could do anything from JSON parsing to OAuth request signing. |
\Communique\HTTPClient | $http_client | The HTTP client you wish to make the request with |
get(String $url, mixed $payload = array(), array $headers = array(), callable $debug = null) : \Communique\RESTClientResponse
Make an HTTP GET request
String | $url | The API to make the request to |
mixed | $payload | The request payload (this will be url encoded and added as query string parameters) |
array | $headers | Any headers you want to add to the request(optional) |
callable | $debug | A function to be used for request debugging. This function should accept two parameters, one for the request object one for the response object. |
REST response encapsulation object
put(String $url, mixed $payload, array $headers = array(), callable $debug = null) : \Communique\RESTClientResponse
Make an HTTP PUT request
String | $url | The API to make the request to |
mixed | $payload | The payload of the request(any data you wish to send across) |
array | $headers | Any headers you want to add to the request(optional) |
callable | $debug | A function to be used for request debugging. This function should accept two parameters, one for the request object one for the response object. |
REST response encapsulation object
post(String $url, mixed $payload, array $headers = array(), callable $debug = null) : \Communique\RESTClientResponse
Make an HTTP POST request
String | $url | The API to make the request to |
mixed | $payload | The payload of the request(any data you wish to send across) |
array | $headers | Any headers you want to add to the request(optional) |
callable | $debug | A function to be used for request debugging. This function should accept two parameters, one for the request object one for the response object. |
REST response encapsulation object
delete(String $url, mixed $payload = array(), array $headers = array(), callable $debug = null) : \Communique\RESTClientResponse
Make an HTTP DELETE request
String | $url | The API to make the request to |
mixed | $payload | The payload of the request(any data you wish to send across) |
array | $headers | Any headers you want to add to the request(optional) |
callable | $debug | A function to be used for request debugging. This function should accept two parameters, one for the request object one for the response object. |
REST response encapsulation object
_call(\Communique\RESTClientRequest $request, callable $debug = null) : \Communique\RESTClientResponse
Makes the HTTP request using the chosen HTTP client.
\Communique\RESTClientRequest | $request | A RESTClientRequest object encapsulating the request |
callable | $debug | A debugging callback to be run after the request has finished. This function is expected to accept two parameters, \Communique\RESTClientRequest and \Communique\RESTClientResponse |
A RESTClientResponse object encapsulating the response