PHP code example of ferjul17 / sellsy-api

1. Go to this page and download the library: Download ferjul17/sellsy-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ferjul17 / sellsy-api example snippets


$client = new Client(['userToken'      => 'xxx', 'userSecret'     => 'xxx',
                      'consumerToken'  => 'xxx', 'consumerSecret' => 'xxx',
                     ]);
                     
var_dump($client->getService('Infos')->call('getInfos', []));
$promise = $client->getService('Infos')->callAsync('getInfos', [])->then(function($res) {
    var_dump($res);
});
$promise->wait();


use SellsyApi\Client;

$client = new Client(['userToken'      => 'xxx', 'userSecret'     => 'xxx',
                      'consumerToken'  => 'xxx', 'consumerSecret' => 'xxx',
                     ]);

$service = $client->getService('Accountdatas');

$response = $service->call('createUnit', ['unit' => ['value' => 'Kg']);

$promise = $service->callAsync('createUnit', ['unit' => ['value' => 'Kg']);
$response = $promise->wait();

var_dump($client->getService('Infos')->retryableCall(function (ServiceInterface $service, $retry, $e) {
    if ($retry > 3) {
        throw $e;
    }
    return ['getInfos', []];
}));
$promise = $client->getService('Infos')->retryableCallAsync(function (ServiceInterface $service, $retry, $e) {
    if ($retry > 3) {
        throw $e;
    }
    return ['getInfos', []];
})->then(function ($res) {
    var_dump($res);
});
$promise->wait();