for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace JeroenBoesten\ShopsUnitedLaravel;
use GuzzleHttp\Client;
use JeroenBoesten\ShopsUnitedLaravel\Modules\Accounts;
use JeroenBoesten\ShopsUnitedLaravel\Modules\Shipments;
class ShopsUnitedLaravel
{
protected $url;
protected $query;
protected $callableUrl;
protected $method = 'GET';
protected $params = [];
public function __construct()
$this->client = new Client(['verify' => config('shops-united-laravel.verify-ssl')]);
client
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->baseUrl = 'https://login.shops-united.nl/api/';
baseUrl
}
public function accounts()
return new Accounts();
public function shipments()
return new Shipments();
protected function call()
$request = $this->client->request($this->method, $this->callableUrl.$this->query, [
'form_params' => $this->params,
]);
return json_decode($request
->getBody()
->getContents(), true);
protected function setGetUrl($url = null)
$this->method = 'GET';
$this->callableUrl = $this->baseUrl.$url;
return $this;
public function setPostUrl($url)
$this->method = 'POST';
public function setDeleteUrl($url)
$this->method = 'DELETE';
protected function addQuery(array $array)
$this->query = '?'.http_build_query($array);
protected function setParams(array $array)
$this->params = $array;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: