madabina / sdk
PHP client for the Madabina merchant REST API
Requires
- php: ^8.2
Requires (Dev)
- phpunit/phpunit: ^11.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-15 21:44:48 UTC
README
Standalone PHP client for the Madabina merchant REST API (PHP 8.2+).
Installation
The standalone Composer repository is madabina-php-sdk.
From Packagist
After the package is published on Packagist, install it with:
composer require madabina/sdk
Directly from GitHub
Before Packagist publication, Composer can install the main branch directly. Add this repository and requirement to your application's composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/madabina-com/madabina-php-sdk.git"
}
],
"require": {
"madabina/sdk": "dev-main"
}
}
Then run:
composer update madabina/sdk
From a local monorepo checkout
For local development in the Madabina monorepo layout, where the application and sdk/ directory are siblings, add the SDK path repository to your application's composer.json:
{
"repositories": [
{
"type": "path",
"url": "../sdk/php",
"options": { "symlink": true, "versions": { "madabina/sdk": "0.1.0" } }
}
],
"require": {
"madabina/sdk": "^0.1"
}
}
Then run:
composer update madabina/sdk
Adjust url if your application is located elsewhere. Composer symlinks the local package, so edits in this checkout are immediately available to the application.
use Madabina\Sdk\MadabinaClient; $api = new MadabinaClient(); $session = $api->auth->login(['email' => getenv('MADABINA_EMAIL'), 'password' => getenv('MADABINA_PASSWORD')]); try { $products = $api->products->list(['search' => 'phone', 'perPage' => 20]); } finally { $api->auth->logout(); }
Pass baseUrl, accessToken, refreshToken, and a custom TransportInterface to the constructor when needed. Tokens stay in memory; persist them only through an application-owned secure store. The client retries one request after a 401 when a refresh token is available.
Resources include auth, products, orders, customers, stats, and notifications. List methods return items, page, perPage, total, and lastPage. API failures throw MadabinaApiException, with HTTP status and validation details.