PHPackages                             statum/statum-php-sdk - 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. statum/statum-php-sdk

ActiveLibrary

statum/statum-php-sdk
=====================

Official PHP SDK for Statum APIs (SMS, Airtime, Account)

v1.0.4(3mo ago)020MITPHPPHP ^8.1CI passing

Since Jan 18Pushed 3mo agoCompare

[ Source](https://github.com/StatumKE/statum-php-sdk)[ Packagist](https://packagist.org/packages/statum/statum-php-sdk)[ RSS](/packages/statum-statum-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

Statum PHP SDK
==============

[](#statum-php-sdk)

Official PHP SDK for Statum APIs (SMS, Airtime, Account). Built for enterprise usage with strict typing and immutable DTOs.

[Full API Documentation](https://docs.statum.co.ke)

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

[](#requirements)

- PHP 8.1 or higher
- Guzzle HTTP Client

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

[](#installation)

```
composer require statum/statum-php-sdk
```

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

[](#authentication)

The SDK uses HTTP Basic Authentication. You need your `consumerKey` and `consumerSecret` from the [Statum Dashboard](https://app.statum.co.ke/user).

```
use Statum\Sdk\StatumClient;

$client = StatumClient::create(
    consumerKey: 'your_consumer_key',
    consumerSecret: 'your_consumer_secret'
);
```

### Configuration Options

[](#configuration-options)

You can also customize the base URL and timeout:

```
use Statum\Sdk\Config\StatumConfig;
use Statum\Sdk\StatumClient;

$config = new StatumConfig(
    consumerKey: 'your_key',
    consumerSecret: 'your_secret',
    baseUrl: 'https://api.statum.co.ke/api/v2',  // Optional
    timeout: 30.0  // Optional, in seconds
);

$client = new StatumClient($config);
```

Usage
-----

[](#usage)

### Phone Number Formats

[](#phone-number-formats)

The SDK accepts phone numbers in these formats:

- `+254712345678` (with country code prefix)
- `254712345678` (without + prefix)

### Airtime

[](#airtime)

Send airtime to a phone number (KES 5 - 10,000).

```
$response = $client->airtime()->sendAirtime(
    phoneNumber: '254712345678',
    amount: '100'
);

echo "Status Code: " . $response->statusCode;
echo "Description: " . $response->description;
echo "Request ID: " . $response->requestId;
```

### SMS

[](#sms)

Send an SMS message using an approved Sender ID.

```
$response = $client->sms()->sendSms(
    phoneNumber: '254712345678',
    senderId: 'STATUM',
    message: 'Hello from Statum SDK!'
);

echo "Status Code: " . $response->statusCode;
echo "Description: " . $response->description;
echo "Request ID: " . $response->requestId;
```

### Account Details

[](#account-details)

Fetch organization and balance details.

```
$response = $client->account()->getAccountDetails();

echo "Status Code: " . $response->statusCode;
echo "Organization: " . $response->organization->name;
echo "Available Balance: KES " . $response->organization->details->availableBalance;
echo "Website: " . $response->organization->details->website;
echo "M-Pesa Top Up Code: " . $response->organization->details->mpesaAccountTopUpCode;

// List service accounts
foreach ($response->organization->accounts as $account) {
    echo $account->account . " (" . $account->serviceName . ")";
}
```

API Response Format
-------------------

[](#api-response-format)

All API responses follow a consistent JSON structure:

### Success Response (200)

[](#success-response-200)

```
{
    "status_code": 200,
    "description": "Operation successful.",
    "request_id": "35235f08c981474abd388755ed43a427"
}
```

### Insufficient Funds (402)

[](#insufficient-funds-402)

```
{
    "status_code": 402,
    "description": "Insufficient funds.",
    "request_id": "ddc8fadc-f065-4736-aa91-14a42e36c1fa"
}
```

### Validation Error (422)

[](#validation-error-422)

```
{
    "status_code": 422,
    "description": "Validation failed.",
    "validation_errors": {
        "phone_number": ["The phone number must be between 10 and 12 digits."]
    },
    "request_id": "207c5782-f2c6-4a5e-b893-bc7b74aea45f"
}
```

### Account Details Response (200)

[](#account-details-response-200)

```
{
    "status_code": 200,
    "description": "Operation successful.",
    "request_id": "5a45bc7b-bf99-49ae-b089-9daf5f4adbb0",
    "organization": {
        "name": "Statum Test",
        "details": {
            "available_balance": 695.15,
            "location": "Nairobi - Westlands",
            "website": "www.statum.co.ke",
            "office_email": "admin@statum.co.ke",
            "office_mobile": "+254722199199",
            "mpesa_account_top_up_code": "B9E573"
        },
        "accounts": [
            { "account": "Statum", "service_name": "sms" },
            { "account": "CONNECT", "service_name": "sms" }
        ]
    }
}
```

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

[](#error-handling)

All errors throw a subclass of `Statum\Sdk\Exceptions\ApiException`.

```
use Statum\Sdk\Exceptions\AuthenticationException;
use Statum\Sdk\Exceptions\ValidationException;
use Statum\Sdk\Exceptions\NetworkException;
use Statum\Sdk\Exceptions\ApiException;

try {
    $client->airtime()->sendAirtime('254712345678', '100');
} catch (AuthenticationException $e) {
    // Invalid credentials (401)
} catch (ValidationException $e) {
    // Validation errors from API (422)
    echo "Request ID: " . $e->getRequestId();
    foreach ($e->getValidationErrors() as $field => $errors) {
        echo "$field: " . implode(', ', $errors);
    }
} catch (NetworkException $e) {
    // Connection/timeout issues
} catch (ApiException $e) {
    // General API errors
    echo "HTTP Status: " . $e->getCode();
    echo "Body: " . $e->getResponseBody();
}
```

Laravel Integration
-------------------

[](#laravel-integration)

Bind the client in your `AppServiceProvider`:

```
public function register()
{
    $this->app->singleton(StatumClient::class, function ($app) {
        return StatumClient::create(
            config('services.statum.key'),
            config('services.statum.secret')
        );
    });
}
```

Security
--------

[](#security)

Please review [SECURITY.md](SECURITY.md) for vulnerability reporting. Credentials should never be hardcoded; use environment variables.

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance79

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Every ~0 days

Total

5

Last Release

111d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.2

v1.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/931a6f10226e9d76e5c3c90b76f680f4b1cd1f648e5e2f8c464c4fdf205f3f6b?d=identicon)[sirBobz](/maintainers/sirBobz)

---

Top Contributors

[![sirBobz](https://avatars.githubusercontent.com/u/15842737?v=4)](https://github.com/sirBobz "sirBobz (16 commits)")

---

Tags

smspaymentsmpesakenyaairtimestatum

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[africastalking/africastalking

Official Africa's Talking PHP SDK

122557.6k10](/packages/africastalking-africastalking)[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)

PHPackages © 2026

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