PHPackages                             razikallayi/laravel-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. [HTTP &amp; Networking](/categories/http)
4. /
5. razikallayi/laravel-sms

ActiveLibrary[HTTP &amp; Networking](/categories/http)

razikallayi/laravel-sms
=======================

A flexible SMS service for Laravel supporting multiple providers like Mithra, Twilio, Nexmo, and more

00PHPCI failing

Since Sep 28Pushed 7mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel SMS Package
===================

[](#laravel-sms-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27abd28f86d981164afcc3a57de902291f1241ba018dc9e66293d05f2b46f00b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617a696b616c6c6179692f6c61726176656c2d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/razikallayi/laravel-sms)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d3622b653d289c19de1e7c50a701b494e6031c054947be7f4fa499d6b7980f82/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f72617a696b616c6c6179692f6c61726176656c2d736d732f54657374733f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/razikallayi/laravel-sms/actions?query=workflow%3ATests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/39e27453b80b40328bd366cbb0f6ab8c993e9833140d342c537e6c08bfde2cc9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f72617a696b616c6c6179692f6c61726176656c2d736d732f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/razikallayi/laravel-sms/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a7c3dc7154d83bec5345f450642b99a81adb46eef11f62246167e229020944a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617a696b616c6c6179692f6c61726176656c2d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/razikallayi/laravel-sms)

A flexible SMS service for Laravel supporting multiple providers like Mithra, Twilio, Nexmo, and more. Send SMS messages easily with a unified API similar to Laravel's Mail system.

Features
--------

[](#features)

- **Multiple SMS Drivers**: Support for Mithra, Twilio, Nexmo, Log, and Array drivers
- **Easy Provider Switching**: Change SMS providers by updating configuration
- **Notification Channel**: Send SMS through Laravel's notification system
- **Queue Support**: SMS messages can be queued for better performance
- **Facade Support**: Easy-to-use SMS facade for sending messages
- **Model Traits**: Add SMS functionality to your models easily

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

[](#installation)

Install the package via Composer:

```
composer require razikallayi/laravel-sms
```

Publish the configuration file:

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

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

[](#configuration)

Add the following environment variables to your `.env` file:

```
# SMS Configuration
SMS_DRIVER=mithra

# Mithra SMS Configuration
MITHRA_SMS_TOKEN=your_mithra_token_here
MITHRA_SMS_SENDER=TXTLCL
MITHRA_SMS_BASE_URL=http://sms.mithraitsolutions.com/httpapi

# Twilio SMS Configuration
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
TWILIO_FROM_NUMBER=+1234567890

# Global SMS Settings
SMS_FROM_NAME="Your App Name"
SMS_FROM_NUMBER=+1234567890
```

Usage
-----

[](#usage)

### Basic SMS Sending

[](#basic-sms-sending)

```
use RaziKallayi\LaravelSms\Facades\SMS;
use RaziKallayi\LaravelSms\Services\SMS\Messages\SmsMessage;

// Simple message
$message = new SmsMessage('Hello, this is a test message!');
$message->to(['1234567890']);
$result = SMS::send($message);

// Advanced message with options
$message = (new SmsMessage('Your OTP is: 123456'))
    ->to(['1234567890'])
    ->route(config('sms.routes.trans_otp'))
    ->type(config('sms.message_types.text'))
    ->templateId('your_template_id');

$result = SMS::send($message);
```

### Using Model Trait

[](#using-model-trait)

Add the `HasSmsNotifications` trait to your models:

```
use RaziKallayi\LaravelSms\Traits\HasSmsNotifications;

class Customer extends Model
{
    use HasSmsNotifications;

    // Your model code...
}

// Send SMS to customer
$customer = Customer::find(1);
$customer->sendSms('Welcome to our service!');
```

### Using Notifications

[](#using-notifications)

Create a notification that uses SMS:

```
use RaziKallayi\LaravelSms\Notifications\SmsChannel;
use RaziKallayi\LaravelSms\Services\SMS\Messages\SmsMessage;

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

    public function toSms($notifiable)
    {
        return new SmsMessage("Your order has been confirmed!");
    }
}

// Send notification
$customer->notify(new OrderConfirmation());
```

### Switching Providers

[](#switching-providers)

To switch SMS providers, simply update your environment variable:

```
# Use Mithra (default)
SMS_DRIVER=mithra

# Use Twilio
SMS_DRIVER=twilio

# Use Log for testing
SMS_DRIVER=log
```

Available Drivers
-----------------

[](#available-drivers)

- **mithra** - Mithra IT Solutions SMS service
- **twilio** - Twilio SMS service
- **nexmo** - Nexmo/Vonage SMS service
- **log** - Log messages to Laravel logs
- **array** - Store messages in memory (for testing)

SMS Routes
----------

[](#sms-routes)

- **Promotional (1)**: For promotional messages
- **Transactional (2)**: For transactional messages
- **Sender ID (3)**: For custom sender ID messages
- **Trans OTP (4)**: For OTP messages
- **International (9)**: For international messages
- **Trans2 (10)**: Alternative transactional route

Message Types
-------------

[](#message-types)

- **Text (1)**: Regular text messages
- **Flash (2)**: Flash SMS messages
- **Unicode (3)**: Unicode messages for special characters

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

[](#error-handling)

All SMS drivers return standardized response arrays:

```
// Success response
[
    'success' => true,
    'message_id' => '123456789',
    'recipients' => ['1234567890'],
    'content' => 'Your message content'
]

// Error response
[
    'success' => false,
    'error_code' => '103',
    'error_message' => 'Invalid contact(s)',
    'recipients' => ['invalid_number']
]
```

Testing
-------

[](#testing)

For testing purposes, use the `log` or `array` drivers:

```
SMS_DRIVER=log  # Messages will be written to logs
SMS_DRIVER=array  # Messages will be stored in memory
```

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

[](#contributing)

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

License
-------

[](#license)

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

Support
-------

[](#support)

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

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance44

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6ca5527c22387b5b070d7cac9306e3241952497b3cc557483b64fdb1c2cea1a?d=identicon)[razikallayi](/maintainers/razikallayi)

---

Top Contributors

[![razikallayi](https://avatars.githubusercontent.com/u/11429908?v=4)](https://github.com/razikallayi "razikallayi (3 commits)")

### Embed Badge

![Health badge](/badges/razikallayi-laravel-sms/health.svg)

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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