kobas / api-client
2.4
2021-03-23 14:15 UTC
Requires
- ext-curl: *
- ext-json: *
- kobas/oauth2-kobas: 1.0
Requires (Dev)
- mockery/mockery: 1.2.0
- phpunit/phpunit: ~5.7.27
- squizlabs/php_codesniffer: ~3.3.2
README
Signs API requests and allows interaction via cURL methods.
Example
/** * Setup */ $companyId = 0000;// company id provided by Kobas $clientId = '';// client id provided by Kobas $clientSecret = '';// client secret provided by Kobas $clientScope = ''; // client scope provided by Kobas $provider = new \Kobas\APIClient\Auth\Provider($companyId, $clientId, $clientSecret, $clientScope); $client = new \Kobas\APIClient\Client($provider); /** * Usage */ $response = $client->get('customer/search', ['email' => 'example@example.com']); echo json_encode($response, JSON_PRETTY_PRINT);
Client Functions
get($route, $params = array(), $headers = array())
Sends a HTTP GET Request to the route provided.
post($route, $params = array(), $headers = array())
Sends a HTTP POST Request to the route provided.
put($route, $params = array(), $headers = array())
Sends a HTTP PUT Request to the route provided.
delete($route, $params = array(), $headers = array())
Sends a HTTP DELETE Request to the route provided.
getRequestInfo()
Returns the result of curl_getinfo()
on the last request made as an array.
setAPIBaseURL($url)
Allows over-riding the base URL (only really needed for development)
setAPIVersion($version)
Allows over-riding of the API version. Might be useful in future?