tomcan / combell-api
Client libraries for the Combell shared hosting public API.
Requires
- php: >=8.1
- ext-json: *
- guzzlehttp/guzzle: ^6.0 || ^7.0
- psr/log: ^1|^2|^3
Requires (Dev)
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^10.0
- symfony/phpunit-bridge: ^6.0
- dev-master
- v5.0.1
- v5.0.0
- v4.0.0
- v3.4.1
- v3.4.0
- v3.3.4
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.12
- v3.2.11
- v3.2.10
- v3.2.9
- v3.2.8
- v3.2.7
- v3.2.6
- v3.2.5
- v3.2.4
- v3.2.3
- v3.2.2
- 3.2.1
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- 2.x-dev
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
This package is auto-updated.
Last update: 2024-12-09 10:46:53 UTC
README
This is a Combell shared-hosting API client implementation. The goal is to provide a client library that makes it easy for you to interact with the Combell shared hosting public API.
Current status
Since the Combell API is still in development and new functionality is added regularly, this library might not implement every call yet. We do try to keep it up-to-date as much as possible. We keep an eye on the Combell API changelog but if there are calls missing, do let us know by opening an issue or even better a pull request ;)
Usage
You can install the library through composer:
composer install tomcan/combell-api
Next, you need to include the composer autoloader. Instantiate the API object with your API key and secret, create the command objects and fire away!
require __DIR__ . '/vendor/autoload.php'; $key = 'YOUR-API-KEY'; $sec = 'YOUR-API-SECRET'; $api = new \TomCan\CombellApi\Common\Api( new \TomCan\CombellApi\Adapter\GuzzleAdapter(), new \TomCan\CombellApi\Common\HmacGenerator($key, $sec) ); $cmd = new \TomCan\CombellApi\Command\Accounts\ListAccounts(); var_dump($api->executeCommand($cmd));
The command will return the data of the call, in the example above that is an array with Account objects. See the test directory for extensive examples of all the calls.
If you need information about the HTTP call, you can ask the api object about it:
// return the HTTP status code. 200 -> 204 indicate success, other codes typically mean failure of some sort $api->getStatusCode(); // rate limiting headers $api->getRateLimitUsage(); $api->getRateLimitRemaining(); $api->getRateLimitReset(); $api->getRateLimitLimit();
If the command is pageable, you can get info about the paging from the command object:
$cmd->getPagingSkipped(); $cmd->getPagingTake(); $cmd->getPagingTotalResults();