PHPackages                             mkakpabla/sms-gateway - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mkakpabla/sms-gateway

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mkakpabla/sms-gateway
=====================

Framework-agnostic SMS gateway with multi-provider fallback support

v1.1.0(1mo ago)116↓100%1MITPHPPHP ^8.3CI passing

Since Apr 17Pushed 1mo agoCompare

[ Source](https://github.com/mkakpabla/sms-gateway)[ Packagist](https://packagist.org/packages/mkakpabla/sms-gateway)[ RSS](/packages/mkakpabla-sms-gateway/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

SMS Gateway
===========

[](#sms-gateway)

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Framework-agnostic SMS gateway with multi-provider fallback support for PHP 8.3+.

Features
--------

[](#features)

- **Multi-driver support** — register multiple SMS providers and switch between them
- **Automatic fallback** — if one provider fails, the next one in the chain is used
- **Laravel integration** — service provider with auto-discovery, notification channel, and publishable config
- **Extensible** — implement `SmsDriverInterface` to add your own providers

Supported Providers
-------------------

[](#supported-providers)

ProviderDriverStatusFasterMessage`faster-message`✅ AvailableAfrikSMS`afriksms`✅ AvailableNATYABIP`natyabip`✅ AvailableInstallation
------------

[](#installation)

```
composer require mkakpabla/sms-gateway
```

### Laravel

[](#laravel)

The service provider is auto-discovered. Publish the configuration file:

```
php artisan vendor:publish --tag=sms-gateway-config
```

Add your credentials to `.env`:

```
SMS_DRIVER=faster-message

# FasterMessage
FASTER_MESSAGE_FROM=MyApp
FASTER_MESSAGE_API_URL=https://api.fastermessage.com
FASTER_MESSAGE_USERNAME=your-username
FASTER_MESSAGE_PASSWORD=your-password

# AfrikSMS
AFRIKSMS_CLIENT_ID=your-client-id
AFRIKSMS_API_KEY=your-api-key
AFRIKSMS_SENDER_ID=AFRIKSMS

# NATYABIP
NATYABIP_USERNAME=your-username
NATYABIP_PASSWORD=your-password
NATYABIP_FROM=EASYSERVICE
NATYABIP_API_URL=https://api.natyabip.com/smsapiprod_web/FR/api.awp
```

Usage
-----

[](#usage)

### Standalone

[](#standalone)

```
use SmsGateway\SmsGateway;
use SmsGateway\SmsMessage;
use SmsGateway\Drivers\FasterMessageDriver;

$gateway = new SmsGateway();

$gateway->registerDriver('faster-message', new FasterMessageDriver(
    from: 'MyApp',
    apiUrl: 'https://api.fastermessage.com',
    username: 'your-username',
    password: 'your-password',
));

$gateway->setDefaultDriver('faster-message');

$gateway->send('+22890001234', SmsMessage::create('Hello!'));
```

#### AfrikSMS

[](#afriksms)

```
use SmsGateway\SmsGateway;
use SmsGateway\SmsMessage;
use SmsGateway\Drivers\AfrikSmsDriver;

$gateway = new SmsGateway();

$gateway->registerDriver('afriksms', new AfrikSmsDriver(
    clientId: 'your-client-id',
    apiKey: 'your-api-key',
    senderId: 'AFRIKSMS',
));

$gateway->setDefaultDriver('afriksms');

$gateway->send('22890001234', SmsMessage::create('Hello!'));
```

#### NATYABIP

[](#natyabip)

```
use SmsGateway\SmsGateway;
use SmsGateway\SmsMessage;
use SmsGateway\Drivers\NatyabipDriver;

$gateway = new SmsGateway();

$gateway->registerDriver('natyabip', new NatyabipDriver(
    apiUrl: 'https://your-natyabip-api-url',
    username: 'your-username',
    password: 'your-password',
    from: 'EASYSERVICE',
));

$gateway->setDefaultDriver('natyabip');

$gateway->send('22890001234', SmsMessage::create('Hello!'));
```

### With fallback

[](#with-fallback)

```
$gateway->registerDriver('driver-a', $driverA);
$gateway->registerDriver('driver-b', $driverB);

$gateway->setFallbackOrder(['driver-a', 'driver-b']);

// Tries driver-a first, falls back to driver-b on failure
$gateway->sendWithFallback('+22890001234', SmsMessage::create('Hello!'));
```

### Laravel Notification

[](#laravel-notification)

Implement the `HasSmsNotification` contract on your notification:

```
use Illuminate\Notifications\Notification;
use SmsGateway\Contracts\HasSmsNotification;
use SmsGateway\SmsMessage;

class OrderShipped extends Notification implements HasSmsNotification
{
    public function via($notifiable): array
    {
        return ['sms-gateway'];
    }

    public function toSms(object $notifiable): SmsMessage
    {
        return SmsMessage::create('Your order has been shipped!');
    }
}
```

Make sure your notifiable model provides a phone number:

```
public function routeNotificationForSms(): string
{
    return $this->phone;
}
```

Creating a Custom Driver
------------------------

[](#creating-a-custom-driver)

Implement `SmsDriverInterface`:

```
use SmsGateway\Contracts\SmsDriverInterface;
use SmsGateway\SmsMessage;

class MyCustomDriver implements SmsDriverInterface
{
    public function send(string $to, SmsMessage $message): void
    {
        // Your implementation here
    }
}
```

Then register it:

```
$gateway->registerDriver('my-driver', new MyCustomDriver());
```

Configuration
-------------

[](#configuration)

The config file (`config/sms-gateway.php`) supports the following options:

KeyDescription`default`The default SMS driver to use`fallback`Ordered list of drivers for the fallback chain`drivers`Per-driver configuration (credentials, API URLs, etc.)Testing
-------

[](#testing)

```
composer test
```

### Quality tools

[](#quality-tools)

```
composer phpstan   # Static analysis
composer phpmd     # Mess detector
composer phpcs     # Code style
composer quality   # Run all checks
```

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

[](#contributing)

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

2

Last Release

53d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/48671774?v=4)[Michel Akpabla](/maintainers/mkakpabla)[@mkakpabla](https://github.com/mkakpabla)

---

Top Contributors

[![mkakpabla](https://avatars.githubusercontent.com/u/48671774?v=4)](https://github.com/mkakpabla "mkakpabla (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mkakpabla-sms-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/mkakpabla-sms-gateway/health.svg)](https://phpackages.com/packages/mkakpabla-sms-gateway)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.9k496.1k32](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3751.2M45](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

744284.3k34](/packages/civicrm-civicrm-core)[roundcube/roundcubemail

The Roundcube Webmail suite

7.0k1.4k3](/packages/roundcube-roundcubemail)[spatie/laravel-export

Create a static site bundle from a Laravel app

670139.5k6](/packages/spatie-laravel-export)[nfse-nacional/nfse-php

This is my package nfse

1493.1k](/packages/nfse-nacional-nfse-php)

PHPackages © 2026

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