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

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

insense/laravel-sms
===================

This package will provide SMS facility to SMS Channels

2.0(5y ago)487[2 PRs](https://github.com/insenseanalytics/sms-laravel-msg91-textlocal/pulls)MITPHPPHP &gt;=5.5.9

Since Aug 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/insenseanalytics/sms-laravel-msg91-textlocal)[ Packagist](https://packagist.org/packages/insense/laravel-sms)[ RSS](/packages/insense-laravel-sms/feed)WikiDiscussions master Synced 3d ago

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

Insense/Laravel SMS
===================

[](#insenselaravel-sms)

A package for the Laravel Framework for sending sms. This package currently supports Textlocal and MSG91 APIs but can be easily extended for others as well. We are open to PRs to extend this other services.

This package provides a wrapper Facade around the internal sms implementation of the supported sms APIs.

##### Basic Example

[](#basic-example)

```
$isTransactionalMsg = false;
$recipient1 = "XXXXXXXXXX";
$recipient2 = "XXXXXXXXXX";
$recipients = [$recipient1, $recipient2];
$msgText = "Your SMS text should be typed here";
SMS::driver()->sendSms($recipients, $msgText, $isTransactionalMsg);
```

Version Compatibility
---------------------

[](#version-compatibility)

This package currently supports Laravel 5.1 and up.

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

[](#installation)

Install the package via composer

```
composer require insense/laravel-sms
```

If using Laravel 5.1 to 5.4, Register the ServiceProvider and (optionally) the Facade

```
// config/app.php

'providers' => [
    ...
    \Insense\LaravelSMS\Providers\SMSChannelServiceProvider::class,

];

...

'aliases' => [
	...
    'SMS' => \Insense\LaravelSMS\Facades\SMS::class,
],
```

Next, publish the config file with the following `artisan` command.

```
php artisan vendor:publish --provider="Insense\LaravelSMS\Providers\SMSChannelServiceProvider" --tag="config"
```

or if using Laravel 5.5+

```
php artisan vendor:publish
```

Now, run migrations

```
php artisan migrate
```

After publishing, add and fill the next values to your [`.env` file](https://laravel.com/docs/configuration#environment-configuration)

```
# Default SMS Driver value can be from "msg91" or "textlocal"
SMS_DRIVER=

# msg91 (private) API key
MSG91_APIKEY=

# msg91 api end point, this can be changed check same from msg91 api doc
MSG91_ENDPOINT=https://api.msg91.com/api/

# msg91 promotional message sender code to be shown to user
MSG91_PROMOSENDER=777777

# msg91 transactional message sender code to be shown to user
MSG91_TRANSSENDER=INSMS

# Now add Text Local APIs configurations

# TextLocal (private) API key
TEXTLOCAL_APIKEY=

# TextLocal Api registration username
TEXTLOCAL_USERNAME=

# TextLocal Api Hashcode
TEXTLOCAL_HASH=

# textlocal api end point, this can be changed check same from textlocal api doc
TEXTLOCAL_ENDPOINT=https://api.textlocal.in/

# textlocal promotional message sender code to be shown to user
TEXTLOCAL_TRANSSENDER=TXTLCL

# textlocal transactional message sender code to be shown to user
TEXTLOCAL_PROMOSENDER=TXTLCL
```

You can also configure the package in your `config/sms.php`.

Add this in you models package, to save SMS delivery reports

```
class SMSReport extends BaseModel
{
	/**
     * The primary key for the model.
     *
     * @var string
     */
    protected $primaryKey = 'sms_report_id';

	/**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = "sms_reports";
}
```

Add appropriate listeners of SMS events in your `EventServiceProvider`

```
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    // to listen for Delivery Report of SMS, populate `SMSReport` Model
    'Insense\LaravelSMS\Events\SMSDeliveryEvent' => [
        'App\Listeners\YourListener1',
    ],
    // to listen for sms sent api triggered, client can now wait for delivery report
    'Insense\LaravelSMS\Events\SMSSentEvent' => [
        'App\Listeners\YourListener2',
    ],
    // to listen for unsubscribed any user(Laravel User) from application because of incorrect number
    'Insense\LaravelSMS\Events\SMSUnsubscribeEvent' => [
        'App\Listeners\YourListener3',
    ],
];
```

### HTTP Client Dependency : Guzzle Http

[](#http-client-dependency--guzzle-http)

Guzzle Http client is used to send requests to API and is a dependency of this package.

Usage
-----

[](#usage)

The Insense SMS package offers most of the functionality to send group SMS and batch SMS

The `SMS::sendSms()` method may be used to send a sms message:

```
/**
 * Send an SMS to one or more comma separated numbers
 * @param       $numbers
 * @param       $message
 * @param bool  $transactional
 * @param bool  $unicode
 * @param array $options country, flash, ignoreNdnc, campaign
 * @return array|mixed
 * @throws Exception
*/
SMS::sendSms(array $numbers, $message = null, $transactional = false, $unicode = false, Carbon $scheduleTime = null, array $options = []);
```

The `SMS::sendSmsGroup()` method may be used to send a sms message:

```
/**
 * Send an SMS to a Group of contacts - group IDs can be retrieved from getGroups()
 * @param       $groupId
 * @param       $message
 * @param bool  $transactional
 * @param bool  $unicode
 * @param array $options test, receipt_url, custom, optouts, validity
 * @return array|mixed
 * @throws Exception
*/
SMS::sendSmsGroup($groupId, $message = null, $transactional = false, $unicode = false, Carbon $scheduleTime = null, array $options = []);
```

The `SMS::createGroup()` method may be used to create a sms group:

```
/**
 * Create a new contact group
 * @param $group_name
 * @return string group id
*/
SMS::createGroup($group_name);
```

The `SMS::getContacts()` method may be used to get contacts sms group:

```
/**
 * Get contacts from a group - Group IDs can be retrieved with the getGroups() function
 * @param     $groupId
 * @return array SMSContacts
*/
SMS::getContacts($groupId = null);
```

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 58.3% 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 ~397 days

Total

3

Last Release

2045d ago

Major Versions

1.0.x-dev → 2.02020-10-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3b4395cbe0ac91e6c75a298f834f347905a340bd030e5f2046249a341569fee?d=identicon)[paras-malhotra](/maintainers/paras-malhotra)

---

Top Contributors

[![amit-insense](https://avatars.githubusercontent.com/u/42092723?v=4)](https://github.com/amit-insense "amit-insense (7 commits)")[![paras-malhotra](https://avatars.githubusercontent.com/u/16099046?v=4)](https://github.com/paras-malhotra "paras-malhotra (5 commits)")

---

Tags

laravelmsg91sms-apitextlocal

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

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

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)

PHPackages © 2026

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