A PHP client for the IBP API.
Installing via composer
composer require sdv/ibp-sdk-php
use SdV\Ibp;
$ibp = new Ibp('API_BASE_URL');
try {
$folders = $ibp->setApplicationId('APPLICATION-ID')
->setApplicationToken('APPLICATION-TOKEN')
->folders();
} catch (ApiException $e) {
/** @var Ibp\Resources\Error */
var_dump($e->error);
}
$ibp->setApplicationId('APPLICATION-ID-HERE');
$ibp->setApplicationToken('APPLICATION-TOKEN-HERE');
$ibp->setUploadToken('UPLOAD-TOKEN-HERE');
$token = $ibp
->setApplicationId('app_id')
->setApplicationSecret('app_secret')
->uploadToken('[email protected]');
Il est possible de passer un paramètre pour configurer la durée de vie du token (en seconde)
// Le token sera utilisable pendant 2 minutes (120 secondes)
$token = $ibp
->setApplicationId('app_id')
->setApplicationSecret('app_secret')
->uploadToken('[email protected]', 120);
$token = $ibp
->setApplicationId('app_id')
->setApplicationSecret('app_secret')
->applicationToken();
Il est possible de passer un paramètre pour configurer la durée de vie du token (en seconde)
// Le token sera utilisable pendant 2 minutes (120 secondes)
$token = $ibp
->setApplicationId('app_id')
->setApplicationSecret('app_secret')
->applicationToken(120);
$folders = $ibp->folders();
$folder = $ibp->folder('591c57736afd7d0106486d02');
$folder = $ibp->createFolder('Mes documents');
$folder = $ibp->updateFolder('591d4dff22b60a00af674c52', 'Images');
$folder = $ibp->addFileInFolder('591d4dff22b60a00af674c52', '59142cd4a64da6014c769813');
$deleted = $ibp->removeFileFromFolder('591d4dff22b60a00af674c52', '59142cd4a64da6014c769813');
$files = $ibp->files();
$file = $ibp->file('59142cd4a64da6014c769813');
$file = $ibp->TagFile('59142cd4a64da6014c769813', 'manual', ['tag 1', 'tag 2']);
$fileContent = fopen(__DIR__. '/README.md', 'r');
$file = $ibp->uploadFile($fileContent);
$ibp->deleteFile('59142cd4a64da6014c769813');
$ibp->setSmartMode('59142cd4a64da6014c769813', false);
$apps = $ibp->applications();
$app = $ibp->application('5911924f302f600102779d23');
$app = $ibp->createApplication('Application iPhone v2', 'La nouvelle application iPhone ...');
$app = $ibp->updateApplication('591d57fe22b60a00e2075f12', 'Application Android v2', 'New Desc');
$isDeleted = $ibp->deleteApplication('591d57fe22b60a00e2075f12');
$methodes = $ibp->methodes();
$methode = $ibp->methode('5911924f302f600102779d23');
$methode = $ibp->createMethode([
'context' => 'square',
'generator' => 'Thumbor',
'param' => [
'force_ration' => '1:1',
'crop_width' => 206,
'crop_width' => 206,
'crop_x' => 931,
'crop_y' => 274
],
'description' => 'Image carré'
]);
$methode = $ibp->updateMethode('591d57fe22b60a00e2075f12', [
'context' => 'square',
'generator' => 'Thumbor',
'param' => [
'force_ration' => '1:1',
'crop_width' => 206,
'crop_width' => 206,
'crop_x' => 931,
'crop_y' => 274,
],
]);
$isDeleted = $ibp->deleteMethode('591d57fe22b60a00e2075f12');
$pipelines = $ibp->pipelines();
Inspired by The Forge SDK