Skip to content

Instantly share code, notes, and snippets.

@ger86
Last active March 26, 2019 12:12
Show Gist options
  • Save ger86/0c5ad1fa8f218583e693b6270cb2a832 to your computer and use it in GitHub Desktop.
Save ger86/0c5ad1fa8f218583e693b6270cb2a832 to your computer and use it in GitHub Desktop.
<?php
/**
* Get request
*
* @param string $path
* @param array $queryParams
* @return array
*/
public function get(string $path, array $queryParams = []): array {
try {
$this->session->save();
$response = $this->client->request(
'GET',
$path,
[
'allow_redirects' => false,
'query' => $queryParams
]
);
return json_decode($response->getBody(), true);
} catch (GuzzleRequestException $exception) {
$requestException = new RequestException();
throw $requestException;
} finally {
$this->session->start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment