Client
in package
implements
Http
Table of Contents
Interfaces
Properties
- $baseUrl : string
- $headers : array<string, string>
- $http : ClientInterface
- $json : Json
- $requestFactory : RequestFactoryInterface
- $streamFactory : StreamFactoryInterface
Methods
- __construct() : mixed
- delete() : mixed
- get() : mixed
- patch() : mixed
- post() : mixed
- put() : mixed
- buildQueryString() : string
- execute() : mixed
- isJSONResponse() : bool
- Checks if any of the header values indicate a JSON response.
- parseResponse() : mixed
Properties
$baseUrl
private
string
$baseUrl
$headers
private
array<string, string>
$headers
$http
private
ClientInterface
$http
$json
private
Json
$json
$requestFactory
private
RequestFactoryInterface
$requestFactory
$streamFactory
private
StreamFactoryInterface
$streamFactory
Methods
__construct()
public
__construct(string $url[, string|null $apiKey = null ][, ClientInterface|null $httpClient = null ][, RequestFactoryInterface|null $reqFactory = null ][, array<int, string> $clientAgents = [] ][, StreamFactoryInterface|null $streamFactory = null ]) : mixed
Parameters
- $url : string
- $apiKey : string|null = null
- $httpClient : ClientInterface|null = null
- $reqFactory : RequestFactoryInterface|null = null
- $clientAgents : array<int, string> = []
- $streamFactory : StreamFactoryInterface|null = null
delete()
public
delete(string $path[, array<string|int, mixed> $query = [] ]) : mixed
Parameters
- $path : string
- $query : array<string|int, mixed> = []
Tags
get()
public
get(string $path[, array<string|int, mixed> $query = [] ]) : mixed
Parameters
- $path : string
- $query : array<string|int, mixed> = []
Tags
patch()
public
patch(string $path[, mixed|null $body = null ][, array<string|int, mixed> $query = [] ]) : mixed
Parameters
- $path : string
- $body : mixed|null = null
- $query : array<string|int, mixed> = []
Tags
post()
public
post(string $path[, mixed|null $body = null ][, array<string|int, mixed> $query = [] ][, string|null $contentType = null ]) : mixed
Parameters
- $path : string
- $body : mixed|null = null
- $query : array<string|int, mixed> = []
- $contentType : string|null = null
Tags
put()
public
put(string $path[, mixed $body = null ][, array<string|int, mixed> $query = [] ][, string|null $contentType = null ]) : mixed
Parameters
- $path : string
- $body : mixed = null
- $query : array<string|int, mixed> = []
- $contentType : string|null = null
buildQueryString()
private
buildQueryString([array<string|int, mixed> $queryParams = [] ]) : string
Parameters
- $queryParams : array<string|int, mixed> = []
Return values
stringexecute()
private
execute(RequestInterface $request) : mixed
Parameters
- $request : RequestInterface
Tags
isJSONResponse()
Checks if any of the header values indicate a JSON response.
private
isJSONResponse(array<string|int, mixed> $headerValues) : bool
Parameters
- $headerValues : array<string|int, mixed>
-
the array of header values to check
Return values
bool —true if any header value contains 'application/json', otherwise false
parseResponse()
private
parseResponse(ResponseInterface $response) : mixed
Parameters
- $response : ResponseInterface