1. Go to this page and download the library: Download sonnenglas/takealot-php-sdk 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/ */
sonnenglas / takealot-php-sdk example snippets
use Sonnenglas\Takealot\Client;
$client = new Client(apiKey: getenv('TAKEALOT_API_KEY'));
$page = $client->sales()->list(['limit' => 50]);
$page->items; // list<Sale>
$page->continuationToken; // string|null — the token for the next page
$page->count; // int|null — total matches (only with
$params = ['order_date__gte' => '2026-06-01', 'limit' => 100];
do {
$page = $client->sales()->list($params);
foreach ($page->items as $sale) {
// ...
}
$params = ['continuation_token' => $page->continuationToken];
} while ($page->hasMore());
// More patient: up to 5 retries.
$client = new Client(apiKey: $key, maxRetries: 5);
// Fail fast: no automatic retries.
$client = new Client(apiKey: $key, maxRetries: 0);
use Sonnenglas\Takealot\Exceptions\AuthenticationException;
use Sonnenglas\Takealot\Exceptions\RateLimitException;
use Sonnenglas\Takealot\Exceptions\TakealotException;
try {
$page = $client->sales()->list(['order_date__gte' => '2026-06-01']);
} catch (AuthenticationException $e) {
// Check that TAKEALOT_API_KEY is set and still active in the Seller Portal.
throw $e;
} catch (RateLimitException $e) {
sleep($e->retryAfter ?? 5);
// ...retry...
} catch (TakealotException $e) {
error_log("Takealot API error ({$e->getCode()}): {$e->getMessage()}");
throw $e;
}
use GuzzleHttp\Psr7\HttpFactory;
use GuzzleHttp\Psr7\Response;
use Http\Mock\Client as MockClient;
use Sonnenglas\Takealot\Client;
$mock = new MockClient();
$mock->addResponse(new Response(200, [], json_encode([
'items' => [/* ...sale rows... */],
'limit' => 20,
], JSON_THROW_ON_ERROR)));
$factory = new HttpFactory();
$client = new Client(
apiKey: 'key_test',
httpClient: $mock,
requestFactory: $factory,
);
$page = $client->sales()->list(['limit' => 20]);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.