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

ActiveLibrary[API Development](/categories/api)

masum/sms-gateway
=================

It is a Laravel package which will serve as gateway to send SMS through various providers. It supports multiple sms gateways, and easily extendable to support new gateways.

v2.0.1(2w ago)020MITPHPPHP ^8.1|^8.2|^8.3|^8.4|^8.5

Since Nov 23Pushed 8mo agoCompare

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

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

Laravel SMS Gateway
===================

[](#laravel-sms-gateway)

[![Latest Stable Version](https://camo.githubusercontent.com/76de282c759206e8396ca5a66454bb2e996e867692e633307d6abed32a934ad6/68747470733a2f2f706f7365722e707567782e6f72672f6d6173756d2f736d732d676174657761792f762f737461626c65)](https://packagist.org/packages/masum/sms-gateway)[![Total Downloads](https://camo.githubusercontent.com/e6201a9d183bbe69139687a7aec61d8a24de8f296018e6ea5b38b698e2b1f5a5/68747470733a2f2f706f7365722e707567782e6f72672f6d6173756d2f736d732d676174657761792f646f776e6c6f616473)](https://packagist.org/packages/masum/sms-gateway)[![Latest Unstable Version](https://camo.githubusercontent.com/356990cef6152fb2c2f6e165bb9e7aa48cc0e39e7e1a84d77f72d7c21d8fbecd/68747470733a2f2f706f7365722e707567782e6f72672f6d6173756d2f736d732d676174657761792f762f756e737461626c65)](https://packagist.org/packages/masum/sms-gateway)[![License](https://camo.githubusercontent.com/df32f10f5a9e28ee42653930c29d765bed609e6e5d7b71225007c5b741b2e4af/68747470733a2f2f706f7365722e707567782e6f72672f6d6173756d2f736d732d676174657761792f6c6963656e7365)](https://packagist.org/packages/masum/sms-gateway)

A Laravel package that provides a unified interface to send SMS through various providers. It supports multiple SMS gateways and is easily extendable to support new gateways.

Features
--------

[](#features)

- **Multiple Provider Support**: Twilio, Nexmo/Vonage, MessageBird, Dialog, BulkSMS Bangladesh, SSL Wireless
- **Simple API**: Unified interface across all providers
- **Easy Configuration**: Configure via `.env` file
- **Extendable**: Easy to add new SMS providers
- **Laravel Integration**: Seamless integration with Laravel applications

Supported Gateways
------------------

[](#supported-gateways)

### International Providers

[](#international-providers)

- **Twilio** - Global SMS provider (Trial &amp; Production)
- **Nexmo/Vonage** - Global SMS provider
- **MessageBird** - Global SMS provider
- **Dialog** - Sri Lanka SMS provider

### Bangladesh Providers

[](#bangladesh-providers)

- **BulkSMS Bangladesh** - Cost-effective local provider
- **SSL Wireless** - Local enterprise provider

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

[](#installation)

Install the package via Composer:

```
composer require masum/sms-gateway
```

### Publish Configuration

[](#publish-configuration)

Publish the configuration file to your Laravel application:

```
php artisan vendor:publish --provider="Masum\SmsGateway\SmsServiceProvider"
```

This will create a `config/sms_gateway.php` file in your application.

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

[](#configuration)

### Environment Variables

[](#environment-variables)

Add your SMS provider credentials to your `.env` file:

```
# Twilio Configuration
TWILIO_SID="your_account_sid"
TWILIO_TOKEN="your_auth_token"
TWILIO_SMS_FROM="+15005550006"

# Nexmo/Vonage Configuration
NEXMO_API_KEY="your_api_key"
NEXMO_API_SECRET="your_api_secret"
NEXMO_SMS_FROM="YourBrand"

# MessageBird Configuration
MESSAGE_BIRD_API_KEY="your_api_key"
MESSAGE_BIRD_SMS_FROM="+12012926824"

# Dialog (Sri Lanka) Configuration
DIALOG_SMS_API_KEY="your_api_key"
DIALOG_SMS_ENDPOINT="your_endpoint"
DIALOG_SMS_FROM="YourBrand"

# BulkSMS Bangladesh Configuration
BULKSMSBD_API_KEY="your_api_key"
BULKSMSBD_SENDER_ID="8809601000000"

# SSL Wireless Configuration
SSL_WIRELESS_USER="your_username"
SSL_WIRELESS_PASS="your_password"
SSL_WIRELESS_SID="your_sender_id"
```

### Configuration File

[](#configuration-file)

The published `config/sms_gateway.php` file contains settings for all supported providers:

```
return [
    'nexmo_sms_api_settings' => [
        'API_KEY' => env('NEXMO_API_KEY', ''),
        'API_SECRET' => env('NEXMO_API_SECRET', ''),
        'SEND_SMS_FROM' => env('NEXMO_SMS_FROM', 'YourBrand'),
    ],
    'twilio_sms_api_settings' => [
        'SID' => env('TWILIO_SID', ''),
        'TOKEN' => env('TWILIO_TOKEN', ''),
        'SEND_SMS_FROM' => env('TWILIO_SMS_FROM', '+15005550006'),
    ],
    'message_bird_sms_api_settings' => [
        'API_KEY' => env('MESSAGE_BIRD_API_KEY', ''),
        'SEND_SMS_FROM' => env('MESSAGE_BIRD_SMS_FROM', '+12012926824'),
    ],
    'dialog_sms_api_settings' => [
        'API_KEY' => env('DIALOG_SMS_API_KEY', ''),
        'ENDPOINT' => env('DIALOG_SMS_ENDPOINT', ''),
        'SEND_SMS_FROM' => env('DIALOG_SMS_FROM', 'YourBrand'),
    ],
    'bulksmsbd_sms_api_settings' => [
        'API_KEY' => env('BULKSMSBD_API_KEY', ''),
        'SENDER_ID' => env('BULKSMSBD_SENDER_ID', '8809601000000'),
    ],
    'ssl_wireless_sms_api_settings' => [
        'USER' => env('SSL_WIRELESS_USER', ''),
        'PASS' => env('SSL_WIRELESS_PASS', ''),
        'SID' => env('SSL_WIRELESS_SID', ''),
    ],
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\TwilioSmsGateway;

// Create gateway instance
$gateway = new TwilioSmsGateway();
$sms = new SmsGateway($gateway);

// Send SMS
$sms->sendSms('+1234567890', 'Hello from Laravel!');

// Get response data
$response = $sms->getResponseData();
echo "Status: " . $response->getStatus();
echo "Message ID: " . $response->getMessageId();
```

### Dynamic Provider Selection

[](#dynamic-provider-selection)

```
use Masum\SmsGateway\SmsGateway;

$provider = config('app.sms_provider', 'twilio');

$gateway = match ($provider) {
    'bulksmsbd' => new \Masum\SmsGateway\BulkSmsBdGateway(),
    'ssl_wireless' => new \Masum\SmsGateway\SslWirelessSmsGateway(),
    'nexmo' => new \Masum\SmsGateway\NexmoSmsGateway(),
    'message_bird' => new \Masum\SmsGateway\MessageBirdSmsGateway(),
    'dialog' => new \Masum\SmsGateway\DialogSmsGateway(),
    default => new \Masum\SmsGateway\TwilioSmsGateway(),
};

$sms = new SmsGateway($gateway);
$sms->sendSms($phoneNumber, $message);
```

Provider Specific Documentation
-------------------------------

[](#provider-specific-documentation)

---

### Twilio

[](#twilio)

[![Twilio](https://camo.githubusercontent.com/6f572ca32c3f07a61460a79022df4211741e27038b0285f721d8ddf95b66c946/68747470733a2f2f7777772e7477696c696f2e636f6d2f6d61726b6574696e672f62756e646c65732f636f6d70616e792f696d672f6c6f676f732f7265642f7477696c696f2d6c6f676f2d7265642e737667)](https://www.twilio.com/)Twilio is a cloud communications platform that allows developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions.

**Website**: [twilio.com](https://www.twilio.com/)

**Documentation**: [Twilio API Docs](https://www.twilio.com/docs/api)

**Trial Credit**: $15.50 free credit for testing

#### Configuration

[](#configuration-1)

Add your Twilio credentials to `.env`:

```
TWILIO_SID="your_account_sid"
TWILIO_TOKEN="your_auth_token"
TWILIO_SMS_FROM="+15005550006"
```

#### Usage Example

[](#usage-example)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\TwilioSmsGateway;

$sms = new SmsGateway(new TwilioSmsGateway());
$sms->sendSms('+1234567890', 'Hello from Twilio!');
```

#### Testing with Magic Numbers

[](#testing-with-magic-numbers)

For trial accounts, use Twilio's magic test numbers:

- **FROM**: `+15005550006`
- **TO**: `+15005550000`, `+15005550001`, etc.

---

### Nexmo/Vonage

[](#nexmovonage)

[![Nexmo](https://camo.githubusercontent.com/ce4f6157becc0476c826fa59e5433c56305ce881aedecb860c866b2313198302/68747470733a2f2f7777772e6e65786d6f2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30362f6e65786d6f2d6c6f676f2d6c672e6a7067)](https://www.nexmo.com/)Nexmo (now Vonage) provides innovative communication SMS and Voice APIs that enable applications and enterprises to easily connect to their customers.

**Website**: [nexmo.com](https://www.nexmo.com/)

**Documentation**: [developer.nexmo.com](https://developer.nexmo.com/)

**Trial Credit**: 2 EUR free test credit

#### Configuration

[](#configuration-2)

Add your Nexmo credentials to `.env`:

```
NEXMO_API_KEY="your_api_key"
NEXMO_API_SECRET="your_api_secret"
NEXMO_SMS_FROM="YourBrand"
```

#### Usage Example

[](#usage-example-1)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\NexmoSmsGateway;

$sms = new SmsGateway(new NexmoSmsGateway());
$sms->sendSms('+1234567890', 'Hello from Nexmo!');
```

---

### MessageBird

[](#messagebird)

[![MessageBird](https://camo.githubusercontent.com/84d7f3ad5daedef2d267c1bf61189984321d0e3508a770aa42dd34b6ceb7245d/68747470733a2f2f7777772e6d657373616765626972642e636f6d2f696d672f6c6f676f2e737667)](https://www.messagebird.com/en/)MessageBird provides powerful communication APIs and technical resources to help you build your communication solution.

**Website**: [messagebird.com](https://www.messagebird.com/en/)

**Documentation**: [developers.messagebird.com](https://developers.messagebird.com/)

**Trial Credit**: 10 free SMS credits

#### Configuration

[](#configuration-3)

Add your MessageBird credentials to `.env`:

```
MESSAGE_BIRD_API_KEY="your_api_key"
MESSAGE_BIRD_SMS_FROM="+12012926824"
```

#### Usage Example

[](#usage-example-2)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\MessageBirdSmsGateway;

$sms = new SmsGateway(new MessageBirdSmsGateway());
$sms->sendSms('+1234567890', 'Hello from MessageBird!');
```

---

### Dialog (Sri Lanka)

[](#dialog-sri-lanka)

[![Dialog](https://camo.githubusercontent.com/2df2136682ca4ce4cb0f533e322ffcfdcfcd87d0cc650e25d3589d2c0ea16cc4/68747470733a2f2f7777772e6469616c6f672e6c6b2f6469616c6f67646f63726f6f742f636f6e74656e742f696d616765732f6469616c6f675f6c6f676f4032782e706e67)](https://www.dialog.lk/)Dialog Axiata PLC provides a Bulk SMS Solution that enables you to communicate via SMS to a mass list of customers/staff through an easy-to-use web portal.

**Website**: [dialog.lk](https://www.dialog.lk/)

#### Configuration

[](#configuration-4)

Add your Dialog credentials to `.env`:

```
DIALOG_SMS_API_KEY="your_api_key"
DIALOG_SMS_ENDPOINT="your_endpoint"
DIALOG_SMS_FROM="YourBrand"
```

#### Usage Example

[](#usage-example-3)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\DialogSmsGateway;

$sms = new SmsGateway(new DialogSmsGateway());
$sms->sendSms('+94771234567', 'Hello from Dialog!');
```

---

### BulkSMS Bangladesh

[](#bulksms-bangladesh)

BulkSMS Bangladesh is a cost-effective local SMS provider for Bangladesh. It automatically handles Bangladesh phone number formatting.

**Phone Number Formats**: Accepts `+8801712345678`, `8801712345678`, or `01712345678`

#### Configuration

[](#configuration-5)

Add your BulkSMS BD credentials to `.env`:

```
BULKSMSBD_API_KEY="your_api_key"
BULKSMSBD_SENDER_ID="8809601000000"
```

#### Usage Example

[](#usage-example-4)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\BulkSmsBdGateway;

$sms = new SmsGateway(new BulkSmsBdGateway());
$sms->sendSms('+8801712345678', 'Hello from BulkSMS BD!');
```

---

### SSL Wireless

[](#ssl-wireless)

SSL Wireless is a local enterprise SMS provider for Bangladesh.

**Phone Number Format**: Requires full international format (`+8801XXXXXXXXX`)

#### Configuration

[](#configuration-6)

Add your SSL Wireless credentials to `.env`:

```
SSL_WIRELESS_USER="your_username"
SSL_WIRELESS_PASS="your_password"
SSL_WIRELESS_SID="your_sender_id"
```

#### Usage Example

[](#usage-example-5)

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\SslWirelessSmsGateway;

$sms = new SmsGateway(new SslWirelessSmsGateway());
$sms->sendSms('+8801712345678', 'Hello from SSL Wireless!');
```

---

Response Handling
-----------------

[](#response-handling)

All gateways return a `ResponseData` object with the following methods:

```
$response = $sms->getResponseData();

// Get response status
$status = $response->getStatus();

// Get unique message ID
$messageId = $response->getMessageId();

// Get message price (if available)
$price = $response->getMessagePrice();
```

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

[](#error-handling)

Always wrap SMS sending in try-catch blocks for proper error handling:

```
use Masum\SmsGateway\SmsGateway;
use Masum\SmsGateway\TwilioSmsGateway;

try {
    $sms = new SmsGateway(new TwilioSmsGateway());
    $sms->sendSms('+1234567890', 'Hello World!');

    $response = $sms->getResponseData();
    echo "SMS sent! Message ID: " . $response->getMessageId();
} catch (\Exception $e) {
    // Log the error
    \Log::error("SMS sending failed: " . $e->getMessage());

    // Handle the error gracefully
    echo "Failed to send SMS. Please try again.";
}
```

Extending the Package
---------------------

[](#extending-the-package)

To add support for a new SMS provider:

1. Create a new gateway class implementing `SmsGatewayInterface`:

```
namespace Masum\SmsGateway;

class CustomSmsGateway implements SmsGatewayInterface
{
    public function send($to, $message)
    {
        // Implementation
    }

    public function getResponseData(): ResponseData
    {
        // Implementation
    }
}
```

2. Add configuration to `config/sms_gateway.php`:

```
'custom_sms_api_settings' => [
    'API_KEY' => env('CUSTOM_SMS_API_KEY', ''),
    // Other settings
],
```

3. Use your new gateway:

```
$sms = new SmsGateway(new CustomSmsGateway());
$sms->sendSms('+1234567890', 'Hello!');
```

Available Gateway Classes
-------------------------

[](#available-gateway-classes)

- `TwilioSmsGateway` - Twilio SMS gateway
- `NexmoSmsGateway` - Nexmo/Vonage SMS gateway
- `MessageBirdSmsGateway` - MessageBird SMS gateway
- `DialogSmsGateway` - Dialog (Sri Lanka) SMS gateway
- `BulkSmsBdGateway` - BulkSMS Bangladesh gateway
- `SslWirelessSmsGateway` - SSL Wireless Bangladesh gateway

All classes implement the `SmsGatewayInterface`.

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

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.x
- Illuminate HTTP Client (for API requests)

Testing
-------

[](#testing)

Test your SMS integration using Laravel Tinker:

```
php artisan tinker
```

```
$sms = new \Masum\SmsGateway\SmsGateway(new \Masum\SmsGateway\TwilioSmsGateway());
$sms->sendSms('+1234567890', 'Test message');
$response = $sms->getResponseData();
var_dump($response);
```

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/new-gateway`)
3. Commit your changes (`git commit -am 'Add new SMS gateway'`)
4. Push to the branch (`git push origin feature/new-gateway`)
5. Create a new Pull Request

You can also contribute by:

- Reporting bugs via [Issues](https://github.com/MasumNishat/laravel-sms/issues)
- Suggesting improvements
- Writing tests
- Improving documentation

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Support
-------

[](#support)

For issues, questions, or feature requests:

- **Email**:
- **Issues**: [GitHub Issues](https://github.com/MasumNishat/laravel-sms/issues)

Credits
-------

[](#credits)

- **Author**: Masum Nishat
- **Email**:
- **GitHub**: [MasumNishat](https://github.com/MasumNishat)

Changelog
---------

[](#changelog)

### Version 1.0.0

[](#version-100)

- Initial release with Twilio, Nexmo, MessageBird, and Dialog support

### Version 2.0.0 (Latest)

[](#version-200-latest)

- Added BulkSMS Bangladesh gateway
- Added SSL Wireless Bangladesh gateway
- Improved phone number formatting for Bangladesh providers
- Updated configuration structure
- Enhanced error handling
- Updated documentation

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance75

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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 ~248 days

Total

2

Last Release

19d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11717288?v=4)[Masum Nishat](/maintainers/MasumNishat)[@MasumNishat](https://github.com/MasumNishat)

---

Top Contributors

[![MasumNishat](https://avatars.githubusercontent.com/u/11717288?v=4)](https://github.com/MasumNishat "MasumNishat (1 commits)")

---

Tags

laraveltwilionexmolaravel sms gatewaybulksmsmessagebirdSSL Wireless

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M227](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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