for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace XoteliaClient;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Message\Response;
class Client
{
/**
* @var ClientInterface
*/
protected $handler;
* @param ClientInterface $handler
public function __construct(ClientInterface $handler)
$this->handler = $handler;
}
* @param string $path
* @param array $options
*
* @return Response
public function get($path, array $options = [])
return $this->sendRequest('GET', $path, $options);
public function put($path, array $options = [])
return $this->sendRequest('PUT', $path, $options);
public function delete($path, array $options = [])
return $this->sendRequest('DELETE', $path, $options);
public function post($path, array $options = [])
return $this->sendRequest('POST', $path, $options);
* @param string $method
* @return array
public function sendRequest($method, $path, array $options = [])
try {
$response = $this->handler->send($this->handler->createRequest($method, $path, $options));
} catch (ClientException $ex) {
$response = $ex->getResponse();
return $response->json();