Download the PHP package sonnenglas/takealot-php-sdk without Composer

On this page you can find all versions of the php package sonnenglas/takealot-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package takealot-php-sdk

takealot-php-sdk

Framework-agnostic PHP SDK for the Takealot Marketplace API — read seller sales, offers, transactions, balances, returns, shipments, facilities, and account information from your Takealot Seller account.

Packagist Version Packagist Downloads PHP Version


Features

Why this SDK?

Takealot does not publish an official PHP SDK at the time of writing. This package is built against the current public Takealot Marketplace API at https://marketplace-api.takealot.com/v1, targets modern PHP (8.2+), and stays out of your dependency-injection container by design.

It is the integration layer SONNENGLAS uses to pull our South African marketplace sales and settlement data into our own systems.

Requirements

Installation

If you do not already have a PSR-18 client installed:

php-http/discovery auto-wires any installed PSR-18 client and PSR-17 factories — you only need to inject them manually if you want to override defaults (timeouts, retry middleware, a mock client in tests, etc.).

Quick start

1. Construct the client

Generate an API key in the Takealot Seller Portal under Settings → API Access, then construct the client with it. Everything else is optional.

The key is sent as the X-API-Key header on every request. Only one API key can be active per seller account at a time.

2. List a page of sales

3. Iterate every sale across pages

iterate() follows the continuation_token for you, so you never have to manage paging by hand:

4. Read your account balance

Documentation

Supported endpoints

The SDK targets the seller-facing read surface of the Marketplace API. Every collection endpoint supports continuation-token pagination, fields selection, and (where applicable) expands.

Resource Endpoint(s) Accessor Operations
Sales GET /sales $client->sales() list(), iterate()
Offers GET /offers, GET /offers/{id}, GET /offers/by_sku/{sku}, GET /offers/by_barcode/{barcode} $client->offers() list(), iterate(), getById(), getBySku(), getByBarcode()
Transactions GET /transactions $client->transactions() list(), iterate()
Balances GET /balances $client->balances() get()
Returns GET /returns, GET /returns/{id} $client->returns() list(), iterate(), getById()
Shipments GET /shipments, GET /shipments/{id} $client->shipments() list(), iterate(), getById()
Facilities GET /facilities/get_enabled_regions $client->facilities() enabledRegions()
Seller GET /seller $client->seller() get()

Single-item lookups (getById(), getBySku(), getByBarcode(), returns()->getById(), shipments()->getById()) return the DTO, or null when the item does not exist (HTTP 404) — they do not throw on a missing item.

Write operations are out of scope. The Marketplace API exposes offer-management endpoints (POST /offers, PATCH /offers/{id}, POST /offers/batch). This SDK deliberately does not wrap them — it is a read-only client. Call them directly if you need to mutate offers.

Pagination

Collection endpoints return a Page:

To walk every page manually, feed the token back in. When a continuation token is supplied, all other query parameters are ignored by the API — pass the token alone:

Or let the SDK do it for you with iterate() — see the pagination guide.

Rate limiting & retries

The client retries HTTP 429 responses automatically:

Tune or disable retries via the constructor:

See the rate-limiting guide for details and for how to inject a no-op sleeper in tests.

Error handling

All SDK exceptions extend Sonnenglas\Takealot\Exceptions\TakealotException.

HTTP Exception When
400 ValidationException Invalid query parameters or filters.
401 / 403 AuthenticationException Missing, invalid, or deactivated API key.
404 NotFoundException A missing resource. Single-item lookups catch this and return null instead.
429 RateLimitException ($retryAfter) Rate limit hit after automatic retries were exhausted.
other ApiException Any other 4xx/5xx, oversized body, or malformed JSON.
— TransportException The PSR-18 client failed (DNS / TCP / TLS / timeout). statusCode is 0.

ApiException (and therefore every subclass) carries $statusCode and the decoded $responseBody:

See the error-handling guide for the full decision matrix.

Testing

The SDK is built test-first against php-http/mock-client, so you can exercise every code path without touching the live API. Swap in a mock PSR-18 client and a no-op Sleeper to make retry tests instant:

Run the SDK's own suite with:

Versioning

This project follows Semantic Versioning 2.0.0. See CHANGELOG.md for the release history.

Contributing

Pull requests, issues, and discussions are welcome. Please read CONTRIBUTING.md before opening a PR — it covers the dev setup, coding standards, and the test-first workflow used throughout the codebase.

Security vulnerabilities should be reported privately — see SECURITY.md.

License

Released under the MIT License.

Credits

Built and maintained by Przemek Peron.

If this SDK saves you time, please consider starring the GitHub repository.


All versions of takealot-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0 || ^2.0
php-http/discovery Version ^1.19
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sonnenglas/takealot-php-sdk contains the following files

Loading the files please wait ...