PHPackages                             strongmb/strongmb-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. strongmb/strongmb-php

ActiveLibrary[API Development](/categories/api)

strongmb/strongmb-php
=====================

Official PHP SDK for the Strongmb API — simple, lightweight, and easy to integrate.

v1.0.0(3w ago)01↓100%MITPHPPHP &gt;=8.1

Since May 16Pushed 3w agoCompare

[ Source](https://github.com/strongmb/strongmb-php)[ Packagist](https://packagist.org/packages/strongmb/strongmb-php)[ Docs](https://developers.strongmb.ng)[ RSS](/packages/strongmb-strongmb-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Strongmb PHP SDK
================

[](#strongmb-php-sdk)

Official PHP SDK for the [Strongmb API](https://developers.strongmb.ng) — buy airtime, data, and more with a few lines of PHP.

> For the full API reference and endpoint details, visit **[developers.strongmb.ng](https://developers.strongmb.ng)**.

---

Requirements
------------

[](#requirements)

- PHP 8.1+
- Composer

Installation
------------

[](#installation)

```
composer require strongmb/strongmb-php
```

---

Quick Start
-----------

[](#quick-start)

```
use Strongmb\Strongmb;

$strongmb = new Strongmb('your-api-key');

$response = $strongmb->data->purchase(
    phone:       '08012345678',
    productCode: 'smb_mtn_sme_1gb_30days',
    reference:   'MYAPP' . strtoupper(uniqid()),
);

if ($response->successful()) {
    echo 'Data sent! Reference: ' . $response->data()['reference'];
} elseif ($response->processing()) {
    echo 'Processing — poll by reference to check status.';
} elseif ($response->failed()) {
    echo 'Transaction failed. Contact support if wallet was debited.';
}
```

---

Authentication
--------------

[](#authentication)

Get your API key from the **Developer** tab in your [Strongmb dashboard](https://dashboard.strongmb.ng).

```
// Live mode
$strongmb = new Strongmb(apiKey: 'your-api-key');

// Sandbox / test mode
$strongmb = new Strongmb(apiKey: 'your-api-key', sandbox: true);
```

---

Data
----

[](#data)

```
// List all available data plans and product codes
$response = $strongmb->data->plans();
$billers  = $response->data()['billers'];

// Purchase a data plan
$response = $strongmb->data->purchase(
    phone:       '08012345678',
    productCode: 'smb_mtn_sme_1gb_30days',
    reference:   'MYAPP_UNIQUE_REF_001',
);
```

Airtime
-------

[](#airtime)

```
// List all airtime providers and product codes
$response = $strongmb->airtime->plans();

// Top up airtime
$response = $strongmb->airtime->purchase(
    phone:       '08012345678',
    productCode: 'smb_mtn_vtu',
    amount:      '100',
    reference:   'MYAPP_UNIQUE_REF_002',
);
```

Account
-------

[](#account)

```
// Authenticated user profile
$response = $strongmb->account->user();

// Wallet balances
$response = $strongmb->account->wallets();

// Transaction history
$response = $strongmb->account->transactions();

// Single transaction by reference
$response = $strongmb->account->transaction('MYAPP_UNIQUE_REF_001');
```

---

Response
--------

[](#response)

Every method returns a `Response` object:

```
$response->ok();          // bool   — true when the API status is successful
$response->message();     // string — human-readable message from the API
$response->data();        // array  — the response payload
$response->code();        // string — machine-readable code (e.g. TRANSACTION_SUCCESSFUL)
$response->traceId();     // string — use this when contacting support
$response->httpStatus();  // int    — HTTP status code
$response->toArray();     // array  — full raw response

// Purchase transaction helpers
$response->successful();  // true when code === TRANSACTION_SUCCESSFUL
$response->processing();  // true when still being processed — poll by reference
$response->failed();      // true when transaction failed — wallet may have been debited
```

### Handling all purchase outcomes

[](#handling-all-purchase-outcomes)

```
if ($response->successful()) {
    $data = $response->data();
    echo 'Done! Reference: ' . $data['reference'];

} elseif ($response->processing()) {
    // Request accepted but not yet fulfilled.
    // Poll account->transaction($reference) until it resolves.
    echo 'Processing — reference: ' . $response->data()['reference'];

} elseif ($response->failed()) {
    // Transaction was attempted but failed.
    // Provide the trace ID to support if the wallet was debited.
    echo 'Failed. Trace ID: ' . $response->traceId();
}
```

---

Error Handling
--------------

[](#error-handling)

```
use Strongmb\Exceptions\ApiException;
use Strongmb\Exceptions\AuthException;
use Strongmb\Exceptions\StrongmbException;

try {
    $response = $strongmb->data->purchase(...);

} catch (AuthException $e) {
    // HTTP 401 — invalid or missing API key
    echo 'Invalid API key.';

} catch (ApiException $e) {
    // HTTP 4xx / 5xx — the API returned an error
    echo $e->getMessage();     // Human-readable message
    echo $e->getApiCode();     // e.g. ERR_INSUFFICIENT_BALANCE
    echo $e->getHttpStatus();  // e.g. 402
    echo $e->getTraceId();     // Send this to developers@strongmb.ng

} catch (StrongmbException $e) {
    // Network error or unexpected failure
    echo 'Network error: ' . $e->getMessage();
}
```

### Exception hierarchy

[](#exception-hierarchy)

```
StrongmbException        — base: network errors, unexpected failures
  └── ApiException       — HTTP 4xx/5xx returned by the API
        └── AuthException — HTTP 401: invalid or missing API key

```

---

Notes
-----

[](#notes)

- Always use a **unique `reference`** per transaction — duplicate references will be rejected.
- References must contain only `a-zA-Z0-9` characters. No spaces, dashes, or special characters.
- Call `$strongmb->data->plans()` or `$strongmb->airtime->plans()` to discover valid `productCode` values before purchasing.

---

Links
-----

[](#links)

- [Full API Documentation](https://developers.strongmb.ng)
- [Dashboard](https://dashboard.strongmb.ng)
- [Packagist](https://packagist.org/packages/strongmb/strongmb-php)
- [Support](mailto:developers@strongmb.ng)

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance95

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

25d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f31db85a29548445266e35b8d9c8a774b57b2bc92d59b08610ce83d613a6a76e?d=identicon)[Strongmb](/maintainers/Strongmb)

---

Top Contributors

[![strongmb-bot](https://avatars.githubusercontent.com/u/285102011?v=4)](https://github.com/strongmb-bot "strongmb-bot (2 commits)")

---

Tags

apisdkdatapaymentsgift cardsphp-sdkNigeriaPHP Libraryairtimebillsmobile rechargevouchersUtility Paymentsstrongmbstrong mbstrongmb apistrongmb sdkstrongmb api clientstrongmb api wrapperstrongmb api integrationstrongmb api phpstrongmb api documentationstrongmb api referencestrongmb api examples

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/strongmb-strongmb-php/health.svg)

```
[![Health](https://phpackages.com/badges/strongmb-strongmb-php/health.svg)](https://phpackages.com/packages/strongmb-strongmb-php)
```

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

61315.4M74](/packages/mollie-mollie-api-php)[temporal/sdk

Temporal SDK

4082.7M22](/packages/temporal-sdk)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

46684.5k5](/packages/deepseek-php-deepseek-php-client)[transbank/transbank-sdk

Transbank SDK

62658.8k14](/packages/transbank-transbank-sdk)[qwen-php/qwen-php-client

robust and community-driven PHP SDK library for seamless integration with the qwen AI API, offering efficient access to advanced AI and data processing capabilities

203.2k1](/packages/qwen-php-qwen-php-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
