SDK to connect your PHP app to Giganter API.
You can install the package manually or by adding it to your composer.json
:
{
"require": {
"gigantier/php-sdk": "^1.0.0"
}
}
To get started, instantiate a new Gigantier client with your credentials.
Note: This requires a Gigantier account.
$config = new Config();
$config->clientId = '{your_client_id}';
$config->clientSecret = '{your_client_secret}';
$config->scope = '{api_scope}';
$gigantier = new Gigantier\Client($config);
Check out the API reference to learn more about authenticating and the available endpoints.
Here is an example of api call:
$response = $gigantier->call("/Category/list");
if ($response->isError()) {
// Error response
} else {
// Ok response
}
Some endpoints need the user to be authenticated, once they are obtained, the authenticate()
method must be called:
$response = $gigantier->authenticate("foo@test.com", "1111111");
if ($response->isError()) {
// Error response
} else {
// Ok response
}
Here is an example of and authenticated api call. Keep in mind that the method authenticate()
must be executed first:
$response = $gigantier->authenticatedCall('/User/me');
if ($response->isError()) {
// Error response
} else {
// Ok response
}
To perform data post you need to pass an array with that data to call()
method:
$data = array('name' => 'John', 'surname' => 'Doe');
$response = $gigantier->authenticatedCall('/User/me', $data);
if ($response->isError()) {
// Error response
} else {
// Ok response
}
Before running the tests execute:
composer install
Then you can run the tests:
vendor/bin/phpunit
To generate a coverage report:
vendor/bin/phpunit --coverage-html ./coverage
Thank you for considering contributing to Gigantier PHP SDK.