PHPackages                             swiftsmsgh/swiftsmsgh-api-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. [API Development](/categories/api)
4. /
5. swiftsmsgh/swiftsmsgh-api-sdk

ActiveLibrary[API Development](/categories/api)

swiftsmsgh/swiftsmsgh-api-sdk
=============================

PHP SDK for the Swiftsms-GH Bulk SMS API

v1.0.0(5mo ago)054[5 PRs](https://github.com/supreme-majesty/swiftsmsgh-api-sdk/pulls)1MITPHPPHP &gt;=8.0CI passing

Since Jan 9Pushed 2mo agoCompare

[ Source](https://github.com/supreme-majesty/swiftsmsgh-api-sdk)[ Packagist](https://packagist.org/packages/swiftsmsgh/swiftsmsgh-api-sdk)[ RSS](/packages/swiftsmsgh-swiftsmsgh-api-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (12)Used By (1)

Swiftsms-GH PHP SDK
===================

[](#swiftsms-gh-php-sdk)

[![PHP Version](https://camo.githubusercontent.com/854124dd57cfd3aad3184fca9760bf1f33a5ec1e5d080cfbe8aa4e3337ba46e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e302d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![Packagist](https://camo.githubusercontent.com/3cc65b9aa466fd2d169e67f60613e2535402485f6093153624a0d6f5875e9495/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7377696674736d7367682f7377696674736d7367682d6170692d73646b2e737667)](https://packagist.org/packages/swiftsmsgh/swiftsmsgh-api-sdk)

The Swiftsms-GH PHP SDK provides a suitable approach to the Swiftsms-GH API from applications written in PHP. It includes pre-defined set of classes and functions for API resource that initialize themselves from API responses.

The library provides other features. For Example:

1. Easy configuration path for fast setup and use
2. Helpers for pagination.

You can sign up for an Swiftsms-GH account at [swiftsmsgh.com](https://swiftsmsgh.com)

Table of Contents
-----------------

[](#table-of-contents)

- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Documentation](#documentation)
- [Usage](#usage)
- [Exception Handling](#exception-handling)
- [HTTP Endpoints](#http-endpoints)
- [Send Messages](#send-messages)
    - [Send SMS](#1-send-sms)
    - [Schedule Message &amp; Custom Sender ID](#2-schedule-message--custom-sender-id)
    - [Send Voice Call](#3-send-voice-call)
    - [Send MMS](#4-send-mms)
    - [Send OTP](#5-send-otp)
    - [Send WhatsApp](#6-send-whatsapp)
    - [Send Viber](#7-send-viber)
- [Contacts Management](#contacts-management)
    - [Contact Groups](#contact-groups)
    - [Individual Contacts](#individual-contacts)
- [Check SMS Credit Balance](#check-sms-credit-balance)
- [View Profile](#view-profile)
- [Status Codes](#status-codes)
- [Response Examples](#response-examples)
- [Contributing](#contributing)
- [Changelog](#changelog)
- [License](#license)

Prerequisites
-------------

[](#prerequisites)

PHP ^8.0 and later

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

[](#installation)

Via [Composer](http://getcomposer.org/)

```
$ composer require swiftsmsgh/swiftsmsgh-api-sdk
```

Via Git Bash

```
git clone git@github.com:supreme-majesty/swiftsmsgh-api-sdk.git
```

Documentation
-------------

[](#documentation)

Please see  for up-to-date documentation

Usage
-----

[](#usage)

### Step 1:

[](#step-1)

If you install the Swiftsms-GH PHP SDK via Git Clone then load the Swiftsms-GH PHP API class file and use namespace.

```
require_once '/path/to/src/Swiftsmsgh.php';
use Swiftsms\Swiftsmsgh;
```

If you install Swiftsms-GH PHP SDK via [Composer](http://getcomposer.org/) require the autoload.php file in the index.php of your project or whatever file you need to use Swiftsms-GH PHP API classes.

```
require __DIR__ . '/vendor/autoload.php';
use Swiftsms\Swiftsmsgh;
```

The Swiftsms-GH PHP SDK endpoints are RESTful, and consume and return JSON. All Http endpoints requires an API Key in the request header.

For more information on how to get an API Key visit [here](https://swiftsmsgh.com/developers) to copy or generate new key for authorization.

Exception Handling
------------------

[](#exception-handling)

The SDK throws `Swiftsms\SwiftsmsException` when an API or network error occurs.

```
try {
    $response = $client->send_sms($recipients, $message);
} catch (Swiftsms\SwiftsmsException $e) {
    echo "Error: " . $e->getMessage();
}
```

HTTP Endpoints
--------------

[](#http-endpoints)

-
- [https://swiftsmsgh.com/api/v3/sms/{uid}](https://swiftsmsgh.com/api/v3/sms/%7Buid%7D)
-
-
-
-
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}/show/](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D/show/)
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D)
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}/store](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D/store)
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}/search/{uid}](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D/search/%7Buid%7D)
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}/update/{uid}](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D/update/%7Buid%7D)
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}/delete/{uid}](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D/delete/%7Buid%7D)
- [https://swiftsmsgh.com/api/v3/contacts/{group\_id}/all](https://swiftsmsgh.com/api/v3/contacts/%7Bgroup_id%7D/all)

### Step 2:

[](#step-2)

Instantiate the SwiftsmsghSMSSDKAPI

```
$api_token = "Enter Your API Token here";

$sender_id = "Enter your approved Sender ID here";

$client = new Swiftsms\Swiftsmsgh($api_token, $sender_id);
```

Send Messages
-------------

[](#send-messages)

### 1. Send SMS

[](#1-send-sms)

```
$recipients = "233538000000,233540000000";
$message = "This is a test message";

$response = $client->send_sms($recipients, $message);
```

### 2. Schedule Message &amp; Custom Sender ID

[](#2-schedule-message--custom-sender-id)

You can pass an optional `$options` array to any sending method.

```
$options = [
    'schedule_time' => '2025-12-25 08:00', // Format: Y-m-d H:i
    'sender_id'     => 'MyAlert'           // Override default Sender ID
];

$client->send_sms($recipients, $message, $options);
```

### 3. Send Voice Call

[](#3-send-voice-call)

```
// gender: 'male' or 'female'
// language: 'en-gb', 'en-us', etc.
$client->send_voice($recipients, "Wake up!", "female", "en-gb");
```

### 4. Send MMS

[](#4-send-mms)

```
$mediaUrl = "https://example.com/image.jpg";
$client->send_mms($recipients, "Here is the photo", $mediaUrl);
```

### 5. Send OTP

[](#5-send-otp)

```
$client->send_otp($recipients, "Your verification code is 1234");
```

### 6. Send WhatsApp

[](#6-send-whatsapp)

```
$client->send_whatsapp($recipients, "Hello from WhatsApp API");
```

### 7. Send Viber

[](#7-send-viber)

```
$client->send_viber($recipients, "Hello from Viber API");
```

Contacts Management
-------------------

[](#contacts-management)

### Contact Groups

[](#contact-groups)

```
// Get all contact groups
$groups = $client->all_contact_groups();

// View a specific contact group
$group = $client->view_contact_group($group_id);

// Create a new contact group
$client->create_contact_group($phones, $groupName);

// Update a contact group
$client->update_contact_group($phones, $groupName);

// Delete a contact group
$client->delete_contact_group($group_id);
```

### Individual Contacts

[](#individual-contacts)

```
// Get all contacts in a group
$contacts = $client->all_contacts_in_group($group_id);

// View a specific contact
$contact = $client->view_contact($group_id, $uid);

// Create a new contact
$client->create_contact($phones, $message);

// Update a contact
$client->update_contact($phones, $message);

// Delete a contact
$client->delete_contact($group_id, $uid);
```

Check SMS Credit Balance
------------------------

[](#check-sms-credit-balance)

```
$get_credit_balance = $client->check_balance();
```

View Profile
------------

[](#view-profile)

```
$get_profile = $client->profile();
```

Status Codes
------------

[](#status-codes)

StatusMessage`ok`Successfully Send`100`Bad gateway requested`101`Wrong action`102`Authentication failed`103`Invalid phone number`104`Phone coverage not active`105`Insufficient balance`106`Invalid Sender ID`107`Invalid SMS Type`108`SMS Gateway not active`109`Invalid Schedule Time`110`Media url required`111`SMS contain spam word. Wait for approvalResponse Examples
-----------------

[](#response-examples)

### Successful SMS Send

[](#successful-sms-send)

```
{
    "status": "ok",
    "message": "Successfully Send",
    "data": {
        "uid": "abc123xyz",
        "to": "233538000000",
        "message": "This is a test message",
        "status": "delivered"
    }
}
```

### Balance Check

[](#balance-check)

```
{
    "status": "ok",
    "data": {
        "remaining_balance": 150.5,
        "currency": "GHS"
    }
}
```

### Error Response

[](#error-response)

```
{
    "status": "error",
    "code": 102,
    "message": "Authentication failed"
}
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for a list of changes.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance77

Regular maintenance activity

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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

175d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/222682860?v=4)[Reborn Dzre](/maintainers/supreme-majesty)[@supreme-majesty](https://github.com/supreme-majesty)

---

Top Contributors

[![supreme-majesty](https://avatars.githubusercontent.com/u/222682860?v=4)](https://github.com/supreme-majesty "supreme-majesty (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/swiftsmsgh-swiftsmsgh-api-sdk/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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