Properties

$baseUri

$baseUri : string

Type

string

$timeout

$timeout : float

Type

float

$connectTimeout

$connectTimeout : float

Type

float

$httpClient

$httpClient : \GuzzleHttp\Client|null

Http client.

Type

Client|null

$httpOptions

$httpOptions : array

Http client options.

Type

array

Methods

get()

get(string  $endpoint, array  $query = [], array  $headers = []) : array|string

Send a GET request.

Parameters

string $endpoint
array $query
array $headers

Returns

array|string —

post()

post(string  $endpoint, string|array  $data, array  $options = []) : array|string

Send a POST request.

Parameters

string $endpoint
string|array $data
array $options

Returns

array|string —

request()

request(string  $method, string  $endpoint, array  $options = []) : array|string

Send request.

Parameters

string $method
string $endpoint
array $options

Returns

array|string —

setHttpClient()

setHttpClient(\GuzzleHttp\Client  $client) : $this

Set http client.

Parameters

\GuzzleHttp\Client $client

Returns

$this —

getHttpClient()

getHttpClient() : \GuzzleHttp\Client

Return http client.

Returns

\GuzzleHttp\Client —

getDefaultHttpClient()

getDefaultHttpClient() : \GuzzleHttp\Client

Get default http client.

Returns

\GuzzleHttp\Client —

setBaseUri()

setBaseUri(string  $url) : $this

setBaseUri.

Parameters

string $url

Returns

$this —

getBaseUri()

getBaseUri() : string

getBaseUri.

Returns

string —

getTimeout()

getTimeout() : float

Returns

float —

setTimeout()

setTimeout(float  $timeout) : self

Parameters

float $timeout

Returns

self —

getConnectTimeout()

getConnectTimeout() : float

Returns

float —

setConnectTimeout()

setConnectTimeout(float  $connectTimeout) : self

Parameters

float $connectTimeout

Returns

self —

getOptions()

getOptions() : array

Get default options.

Returns

array —

setOptions()

setOptions(array  $options) : $this

setOptions.

Parameters

array $options

Returns

$this —

getHttpOptions()

getHttpOptions() : array

Returns

array —

setHttpOptions()

setHttpOptions(array  $httpOptions) : self

Parameters

array $httpOptions

Returns

self —

unwrapResponse()

unwrapResponse(\Psr\Http\Message\ResponseInterface  $response) : array|string

Convert response.

Parameters

\Psr\Http\Message\ResponseInterface $response

Returns

array|string —