PHPackages                             openbackend/nepali-sms - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. openbackend/nepali-sms

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

openbackend/nepali-sms
======================

A comprehensive Laravel package for integrating popular Nepali SMS gateways including Sparrow SMS, Sparrow A2P, Ebeema, EasySMS and more

v1.1.1(9mo ago)00MITPHP ^8.1

Since Jul 29Pushed 9mo agoCompare

[ Source](https://github.com/openbackend/laravel-nepali-sms)[ Packagist](https://packagist.org/packages/openbackend/nepali-sms)[ Docs](https://github.com/openbackend/laravel-nepali-sms)[ RSS](/packages/openbackend-nepali-sms/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Nepali SMS Gateway Integrator
=====================================

[](#laravel-nepali-sms-gateway-integrator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27728841555b300a1600ed4c2898d75866d661d307d8c3cdec9a904a4d316a67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e6261636b656e642f6e6570616c692d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/openbackend/nepali-sms)[![Total Downloads](https://camo.githubusercontent.com/5fd218b36e27740106abc926faa7c3b8bd367ca9ede9915831e8e89917db875e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70656e6261636b656e642f6e6570616c692d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/openbackend/nepali-sms)[![License](https://camo.githubusercontent.com/8153daeace670f9ed7a3b37077528c72dd7311698a0bccc7acd509aab97fd2b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f70656e6261636b656e642f6e6570616c692d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/openbackend/nepali-sms)

A comprehensive Laravel package for integrating popular Nepali SMS gateways with advanced features like OTP verification, bulk messaging, delivery tracking, and more.

Supported SMS Gateways
----------------------

[](#supported-sms-gateways)

- **Sparrow SMS** - Popular SMS gateway in Nepal
- **Sparrow A2P** - Application-to-Person messaging
- **Ebeema SMS** - Reliable SMS service provider
- **EasySMS** - Simple SMS integration
- **SMS24x7** - 24/7 SMS service
- **Custom Gateway** - Add your own SMS provider

Features
--------

[](#features)

- 🚀 **Multiple Gateway Support** - Switch between different SMS providers
- 📱 **OTP Generation &amp; Verification** - Built-in OTP system with expiration
- 📊 **Delivery Tracking** - Track message delivery status
- 🔄 **Queue Support** - Send SMS asynchronously using Laravel queues
- 📈 **Bulk Messaging** - Send messages to multiple recipients
- 🎯 **Template Support** - Pre-defined message templates
- 📝 **Logging** - Comprehensive logging for debugging
- 🔒 **Rate Limiting** - Prevent abuse with configurable rate limits
- 📊 **Analytics** - SMS sending statistics and reports
- 🌐 **Multi-language** - Support for English and Nepali text
- 🔄 **Failover** - Automatic fallback to backup gateways
- 📱 **Laravel Notifications** - Integration with Laravel notification system

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher (supports Laravel 12)

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

[](#installation)

Install the package via Composer:

```
composer require openbackend/nepali-sms
```

Publish the configuration file:

```
php artisan vendor:publish --provider="OpenBackend\NepaliSms\NepaliSmsServiceProvider"
```

Run the migrations to create necessary tables:

```
php artisan migrate
```

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

[](#configuration)

Configure your SMS gateways in `config/nepali-sms.php`:

```
return [
    'default' => env('NEPALI_SMS_DEFAULT_GATEWAY', 'sparrow'),

    'gateways' => [
        'sparrow' => [
            'driver' => 'sparrow',
            'token' => env('SPARROW_SMS_TOKEN'),
            'from' => env('SPARROW_SMS_FROM', 'SPARROW'),
        ],

        'sparrow_a2p' => [
            'driver' => 'sparrow_a2p',
            'client_id' => env('SPARROW_A2P_CLIENT_ID'),
            'client_secret' => env('SPARROW_A2P_CLIENT_SECRET'),
            'from' => env('SPARROW_A2P_FROM'),
        ],

        'ebeema' => [
            'driver' => 'ebeema',
            'username' => env('EBEEMA_USERNAME'),
            'password' => env('EBEEMA_PASSWORD'),
            'from' => env('EBEEMA_FROM'),
        ],
    ],

    'otp' => [
        'length' => 6,
        'expiry' => 300, // 5 minutes
        'template' => 'Your OTP code is: {otp}. Valid for {expiry} minutes.',
    ],

    'rate_limit' => [
        'enabled' => true,
        'max_attempts' => 5,
        'decay_minutes' => 1,
    ],
];
```

Add your gateway credentials to `.env`:

```
NEPALI_SMS_DEFAULT_GATEWAY=sparrow

# Sparrow SMS
SPARROW_SMS_TOKEN=your_sparrow_token
SPARROW_SMS_FROM=YourApp

# Sparrow A2P
SPARROW_A2P_CLIENT_ID=your_client_id
SPARROW_A2P_CLIENT_SECRET=your_client_secret
SPARROW_A2P_FROM=YourApp

# Ebeema SMS
EBEEMA_USERNAME=your_username
EBEEMA_PASSWORD=your_password
EBEEMA_FROM=YourApp
```

Basic Usage
-----------

[](#basic-usage)

### Sending a Simple SMS

[](#sending-a-simple-sms)

```
use OpenBackend\NepaliSms\Facades\NepaliSms;

// Send SMS using default gateway
NepaliSms::to('9841234567')
    ->message('Hello from Nepal!')
    ->send();

// Send SMS using specific gateway
NepaliSms::gateway('sparrow')
    ->to('9841234567')
    ->message('Hello from Sparrow!')
    ->send();
```

### Sending Bulk SMS

[](#sending-bulk-sms)

```
$recipients = ['9841234567', '9851234567', '9861234567'];

NepaliSms::to($recipients)
    ->message('Bulk message to all recipients')
    ->send();
```

### OTP Generation and Verification

[](#otp-generation-and-verification)

```
// Generate and send OTP
$otp = NepaliSms::generateOtp('9841234567');

// Verify OTP
$isValid = NepaliSms::verifyOtp('9841234567', '123456');

if ($isValid) {
    // OTP is valid
} else {
    // Invalid or expired OTP
}
```

### Using Templates

[](#using-templates)

```
// Create a template
NepaliSms::createTemplate('welcome', 'Welcome {name} to our platform!');

// Send using template
NepaliSms::to('9841234567')
    ->template('welcome', ['name' => 'John'])
    ->send();
```

### Queue Support

[](#queue-support)

```
// Send SMS asynchronously
NepaliSms::to('9841234567')
    ->message('This will be sent via queue')
    ->queue();

// Send with delay
NepaliSms::to('9841234567')
    ->message('This will be sent after 5 minutes')
    ->delay(now()->addMinutes(5))
    ->queue();
```

Advanced Features
-----------------

[](#advanced-features)

### Laravel Notifications Integration

[](#laravel-notifications-integration)

Create a notification class:

```
php artisan make:notification WelcomeMessage
```

```
use OpenBackend\NepaliSms\Channels\NepaliSmsChannel;
use OpenBackend\NepaliSms\Messages\NepaliSmsMessage;

class WelcomeMessage extends Notification
{
    public function via($notifiable)
    {
        return [NepaliSmsChannel::class];
    }

    public function toNepaliSms($notifiable)
    {
        return NepaliSmsMessage::create()
            ->message('Welcome to our platform!')
            ->gateway('sparrow');
    }
}
```

Send notification:

```
$user->notify(new WelcomeMessage());
```

### Delivery Tracking

[](#delivery-tracking)

```
$message = NepaliSms::to('9841234567')
    ->message('Track this message')
    ->send();

// Check delivery status
$status = NepaliSms::getDeliveryStatus($message->id);

// Get detailed delivery report
$report = NepaliSms::getDeliveryReport($message->id);
```

### Analytics and Reports

[](#analytics-and-reports)

```
// Get SMS statistics for today
$stats = NepaliSms::getStatistics();

// Get statistics for specific date range
$stats = NepaliSms::getStatistics(
    from: now()->subDays(7),
    to: now()
);

// Get gateway-wise statistics
$gatewayStats = NepaliSms::getGatewayStatistics('sparrow');
```

### Rate Limiting

[](#rate-limiting)

```
// Check if user can send SMS
if (NepaliSms::canSendSms('9841234567')) {
    NepaliSms::to('9841234567')
        ->message('Rate limited message')
        ->send();
} else {
    // Rate limit exceeded
}
```

### Failover Support

[](#failover-support)

```
// Configure multiple gateways with priority
NepaliSms::gateways(['sparrow', 'ebeema', 'easysms'])
    ->to('9841234567')
    ->message('This will try multiple gateways if one fails')
    ->send();
```

Artisan Commands
----------------

[](#artisan-commands)

### Test SMS Gateway

[](#test-sms-gateway)

```
php artisan nepali-sms:test --gateway=sparrow --to=9841234567
```

### Generate OTP

[](#generate-otp)

```
php artisan nepali-sms:otp --generate --phone=9841234567
```

### Verify OTP

[](#verify-otp)

```
php artisan nepali-sms:otp --verify --phone=9841234567 --code=123456
```

### View Statistics

[](#view-statistics)

```
php artisan nepali-sms:stats
```

### Clear Old SMS Logs

[](#clear-old-sms-logs)

```
php artisan nepali-sms:cleanup --days=30
```

Events
------

[](#events)

The package fires several events that you can listen to:

- `MessageSending` - Before sending SMS
- `MessageSent` - After SMS is sent successfully
- `MessageFailed` - When SMS sending fails
- `OtpGenerated` - When OTP is generated
- `OtpVerified` - When OTP is verified
- `OtpExpired` - When OTP expires

Example listener:

```
Event::listen(MessageSent::class, function ($event) {
    Log::info('SMS sent successfully', [
        'to' => $event->message->to,
        'gateway' => $event->message->gateway,
        'id' => $event->message->id,
    ]);
});
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run tests with coverage:

```
composer test-coverage
```

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

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

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

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

Credits
-------

[](#credits)

- [Rudra Ramesh](https://github.com/rudraramesh)
- [OpenBackend](https://github.com/openbackend)
- [All Contributors](../../contributors)

Support
-------

[](#support)

- [Documentation](https://github.com/openbackend/laravel-nepali-sms/wiki)
- [Issues](https://github.com/openbackend/laravel-nepali-sms/issues)
- [Discussions](https://github.com/openbackend/laravel-nepali-sms/discussions)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance56

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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

293d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ee24e4136339578d209efc1e185915bf09e79b3bdfa040e91900c58bd12c192?d=identicon)[rudraramesh](/maintainers/rudraramesh)

---

Top Contributors

[![rudraramesh](https://avatars.githubusercontent.com/u/54761880?v=4)](https://github.com/rudraramesh "rudraramesh (2 commits)")

---

Tags

laravelotpnotificationsmsgatewaynepalbulk-smseasysmssparrowebeema

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/openbackend-nepali-sms/health.svg)

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

###  Alternatives

[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)

PHPackages © 2026

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