PHPackages                             tesark/msg91-php - 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. tesark/msg91-php

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

tesark/msg91-php
================

Send SMS and OTP using MSG91 service

0.1.1(8y ago)48.1k↑41.3%3[3 issues](https://github.com/tesark/msg91-php/issues)MITPHP

Since Oct 23Pushed 8y ago3 watchersCompare

[ Source](https://github.com/tesark/msg91-php)[ Packagist](https://packagist.org/packages/tesark/msg91-php)[ RSS](/packages/tesark-msg91-php/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

[![image](https://camo.githubusercontent.com/7847dfade914145d97be0cfb0c066a3fe62c358ddf47c0e9ce064b016eb1c425/68747470733a2f2f7777772e74657361726b2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031362f30342f54455341524b546563685f526f79616c4031782e706e67)](https://www.tesark.com/)

MSG91 SMS &amp; OTP Composer Package
====================================

[](#msg91-sms--otp-composer-package)

[![image](https://camo.githubusercontent.com/50e59ffd6139ca7daa192f52625b6e33e3252f3d9df793251601c56c01f46305/68747470733a2f2f7472617669732d63692e6f72672f74657361726b2f6d736739312d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tesark/msg91-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d243082e8023f09ef7e28ac595f46ba69d24eacec0ea3608f4bde7135db6acde/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74657361726b2f6d736739312d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tesark/msg91-php/?branch=master)[![Build Status](https://camo.githubusercontent.com/252eabc7ac4457b550a2db1f1c6d12773289982718b0b395569a047ded98cb62/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74657361726b2f6d736739312d7068702f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tesark/msg91-php/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/fc2e9df7278e5e4a05beb540af0640e7877624317e2420891861d6e3325b8255/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74657361726b2f6d736739312d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tesark/msg91-php/?branch=master)

- [Installation](#installation)
    - [Supported Framework](#supportedframeworks)
- [Config file setup](#configfilesetup)
- [ SMS API](#smsapi)
    - [SendTransactional &amp; SendPromotional](#1.sendTransactionalsendPromotionalusingget)
    - [SendBulkSms](#2.sendbulksmsusingpost)
- [ OTP API](#otpapi)
    - [SEND OTP](#sendotp)
    - [RESEND OTP](#resendotp)
    - [VERIFY OTP](#verifyotp)

### Installation

[](#installation)

Run the following command to install the latest applicable version of the package:

```
composer require tesark/msg91-php
```

```
"require": {
        "tesark/msg91-php": "dev-master"
        }
```

Supported FrameWorks
--------------------

[](#supported-frameworks)

- `Laravel5.3`, `Laravel5.4`, `laravel5.5` we are suggested Laravel frame work
- `Symfony 3.1`, `Slim 3.8 `, `Zend 3.0`, `Codeigniter 3.1`

Config file setup
-----------------

[](#config-file-setup)

- Config file Now, using only for send Authkey.

`Three ways send Authkey`

Tips 1: `Using Config`

```
'msg91' => [
    'common' => [
        'transAuthKey' =>  "17086...........9a87a1",
        'promoAuthKey' =>  "17086...........9a87a1",
        'otpAuthKey'   =>  "17043...........59969531",
    ],
]
```

Tips 2: `Using Class parameter`

```
use Sender\PromotionalSms;
use Sender\TransactionalSms;

$sms = new PromotionalSms("17043...........59969531");
$sms->PromotionalSms("919******541,919******728",$sample);

$sms = new TransactionalSms("17043...........59969531");
$sms->sendTransactional("919******541,919******728",$sample);
```

Tips 3: `Dot Env File`

```
TRANSAUTHKEY=170***************a87a1
OTPAUTHKEY=1704***************531
```

### Coding Standards

[](#coding-standards)

The entire library is intended to be PSR-1, PSR-2 compliant.

### SMS

[](#sms)

[Msg91 Send SMS](http://api.msg91.com/apidoc/textsms/send-sms.php)

- `GET` Method
- `POST` Method

```
 GET
http://api.msg91.com/api/sendhttp.php?authkey=YourAuthKey&mobiles=919999999990,919999999999&message=message&sender=ABCDEF&route=4&country=0
```

Parameter nameData typeDescriptionauthkey \*alphanumericLogin authentication key (this key is unique for every user)mobiles \*integerKeep numbers in international format (with country code), multiple numbers should bemessage \*varcharMessage content to sendsender \*varcharReceiver will see this as sender's ID.route \*varcharIf your operator supports multiple routes then give one route name. Eg: route=1 for promotional, route=4 for transactional SMS.countrynumeric0 for international,1 for USA, 91 for India.flashinteger(0/1) flash=1 (for flash SMS)unicodeinteger(0/1) unicode=1 (for unicode SMS)schtimedate and timeWhen you want to schedule the SMS to be sent. Time format could be of your choice you can use Y-m-d h:i:s (2020-01-01 10:10:00) Or Y/m/d h:i:s (2020/01/01 10:10:00) Or you can send unix timestamp (1577873400)afterminutesintegerTime in minutes after which you want to send sms.responsevarcharBy default you will get response in string format but you want to receive in other format (json,xml) then set this parameter. for example: &amp;response=json or &amp;response=xmlcampaignvarcharCampaign name you wish to create.operator supports.

- route=1 for promotional
- route=4 for transactional

SMS API
=======

[](#sms-api)

1. SendTransactional &amp; SendPromotional Using GET
----------------------------------------------------

[](#1-sendtransactional--sendpromotional-using-get)

- `GET` Method

### Input Data

[](#input-data)

- `$mobileNumber`"919**541,919**728" String 9195\*\*\*\*\*\*\*\*3 Integer
- `$data` Array

### Sample Input Data

[](#sample-input-data)

```
Tips 1:
$sample = [
    'message'      => 'WELCOME TO TESARK',
    'sender'       => 'UTOOWE',
    'country'      => 91,
    'flash'        => 1,
    'unicode'      => 1,
    'schtime'      => "2020-01-01 10:10:00",
    'response'     => "json",
    'afterminutes' => 10,
    'campaign'     => "venkat"
];
use Sender\PromotionalSms;
use Sender\TransactionalSms;

$sms = new PromotionalSms();
$sms->PromotionalSms("919******541,919******728",$sample);

$sms = new TransactionalSms();
$sms->sendTransactional("919******541,919******728",$sample);

Tips 2:
$sample = [
    'message'      => 'WELCOME TO TESARK',
    'sender'       => 'TOOME',
    'country'      => 91,
    'flash'        => 1,
    'unicode'      => 1,
    'schtime'      => "2020-01-01 10:10:00",
    'response'     => "json",
    'afterminutes' => 10,
    'campaign'     => "venkat"
];

use Sender\PromotionalSms;
use Sender\TransactionalSms;

$sms = new PromotionalSms();
$sms = new TransactionalSms();

$sms->sendTransactional(919******541,$sample);
$sms->PromotionalSms(919******541,$sample);
```

### API

[](#api)

```
use Sender\TransactionalSms;
$sms = new TransactionalSms();
$sms->sendTransactional($mobileNumber, $data);
```

```
use Sender\PromotionalSms;
$sms = new PromotionalSms();
$sms->sendPromotional($mobileNumber, $data);
```

2. SendBulkSms Using POST
-------------------------

[](#2-sendbulksms-using-post)

- `POST` Method

### Input Data

[](#input-data-1)

- `$data` Array

### Sample Input Data

[](#sample-input-data-1)

```
Tips 1:
$sample = [
    [
        'authkey' => '17086************k599a87a1',
        'sender'  => 'MULSMS',
        'schtime'=> '2016-03-31 11:17:39',
        'campaign'=> 'venkat',
        'country'=> '91',
        'flash'=> 1,
        'unicode'=> 1,
        'content' =>[
           [
           'message'    => 'welcome multi sms',
           'mobile' => '91951******1,91880******4,917******972'
           ],
           [
              'message'    => 'tesark world',
              'mobile' => '9195******41,918******824,917******972'
           ]
        ]
    ]
];
Tips 2:
$sample = [
    [
       'authkey' => '17086************k599a87a1',
       'sender'  => 'MULSMS',
       'content' =>[
            [
                'message'    => 'welcome multi sms',
                'mobile' => '919******541,918******824,917******972'
            ],
            [
                'message'    => 'tesark world',
                'mobile' => '9195******41,91880******4,9170******72'
            ]
        ]
    ],
    [
       'authkey' => '17086************k599a87a1',
       'sender'  => 'SUNSMS',
       'content' =>[
            [
                'message'    => 'hai how are u',
                'mobile' => '9195******41,918******824,9******2972'
            ],
            [
                'message'    => 'hai welcome',
                'mobile' => '9195******41,918******824,9******42972'
            ]
        ]
    ]
];
```

### API

[](#api-1)

```
use Sender\PromotionalSms;
$sms = new PromotionalSms();
$sms->sendBulkSms($data);
```

Sample XML
==========

[](#sample-xml)

```

  17086************k599a87a1
  MULSMS

```

Sample Output
=============

[](#sample-output)

```
5134842646923e183d000075
```

> Note : Output will be request Id which is alphanumeric and contains 24 character like mentioned above. With this request id, delivery report can be viewed. If request not sent successfully, you will get the appropriate error message. View error codes

OTP API
=======

[](#otp-api)

[Msg91 Send OTP](http://api.msg91.com/apidoc/sendotp/send-otp.php)

SEND OTP
--------

[](#send-otp)

- `GET` Method

```
GET
http://api.msg91.com/api/sendotp.php?authkey=YourAuthKey&mobile=919999999990&message=Your%20otp%20is%202786&sender=senderid&otp=2786
```

Parameter nameData typeDescriptionauthkey \*alphanumericLogin authentication key (this key is unique for every user)mobile \*integerKeep number in international format (with country code)messagevarcharMessage content to send. (default : Your verification code is ##OTP##.)sendervarcharReceiver will see this as sender's ID. (default : OTPSMS)otpintegerOTP to send and verify. If not sent, OTP will be generated.otp\_expiryintegerExpiry of OTP to verify, in minutes (default : 1 day, min : 1 minute)otp\_lengthintegerNumber of digits in OTP (default : 4, min : 4, max : 9)### Input Data

[](#input-data-2)

- `authkey` \* alphanumeric
- `mobile` \* Integer
- `message` varchar
- `sender` varchar
- `otp` Integer
- `otp_expiry` Integer
- `otp_length` Integer

### Sample Input Data

[](#sample-input-data-2)

```
$data = [
    'message'       => "Your verification code is ##5421##",
    'sender'        => "Venkat",
    'otp'           => 5421,
    'otp_expiry'    => 20,
    'otp_length'    => 4
];
```

### API

[](#api-2)

```
use Sender\Otp;

$otp = new Otp();
$otp->sendOtp($mobile,$data);
```

Sample Output
-------------

[](#sample-output-1)

```
{"message":"3763646c3058373530393938","type":"success"}
```

RESEND OTP
----------

[](#resend-otp)

- `GET` Method

```
http://api.msg91.com/api/retryotp.php?authkey=YourAuthKey&mobile=919999999990&retrytype=voice
```

Parameter nameData typeDescriptionauthkey \*alphanumericLogin authentication key (this key is unique for every user)mobile \*integerKeep number in international format (with country code)retrytypevarcharMethod to retry otp : voice or text. Default is voice.### Input Data

[](#input-data-3)

- `$mobile` Integer
- `$retrytype` String

### Sample Input Data

[](#sample-input-data-3)

```
use Sender\Otp;

$otp = new Otp();

$otp->resendOtp($mobile,"voice")
$otp->resendOtp($mobile,"text")
$otp->resendOtp($mobile)
```

### API

[](#api-3)

```
use Sender\Otp;

$otp = new Otp();
$otp->resendOtp($mobile,$retrytype)
```

Sample Output

```
{"message":"otp_sent_successfully","type":"success"}
```

VERIFY OTP
----------

[](#verify-otp)

- `GET` Method

```
http://api.msg91.com/api/verifyRequestOTP.php?authkey=YourAuthKey&mobile=919999999990&otp=2786
```

Parameter nameData typeDescriptionauthkey \*alphanumericLogin authentication key (this key is unique for every user)mobile \*integerKeep number in international format (with country code)otp \*varcharOTP to verify### Input Data

[](#input-data-4)

- `$mobile` Integer
- `$otp` string

### Sample Input Data

[](#sample-input-data-4)

OtpSend::verifyOtp(919\*\*\***41,9195**421);

### API

[](#api-4)

```
use Sender\Otp;

$otp = new Otp();
$otp->verifyOtp($mobile,$otp);
```

Sample Output

```
{"message":"number_verified_successfully","type":"success"}
```

### NOTE:

[](#note)

```
- Mobile number not attached `+` sign like this `+9195*****41`
```

### Get in touch

[](#get-in-touch)

If you have any suggestions, feel free to email me at  or ping me on Twitter with @venkatskpi.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance5

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.5% 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 ~129 days

Total

2

Last Release

3045d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49bcd19d12a4aefebf70c87c556ea7e53bf0e97049d82d268896aa818c1867aa?d=identicon)[tesark](/maintainers/tesark)

---

Top Contributors

[![venkatsamuthiram](https://avatars.githubusercontent.com/u/17342836?v=4)](https://github.com/venkatsamuthiram "venkatsamuthiram (312 commits)")[![chan-tqube](https://avatars.githubusercontent.com/u/21287810?v=4)](https://github.com/chan-tqube "chan-tqube (17 commits)")[![ajaiy](https://avatars.githubusercontent.com/u/2308744?v=4)](https://github.com/ajaiy "ajaiy (1 commits)")

---

Tags

otpsmslaravel-smslaravel otpsms-otpsms and otpmobile smsmobile otpmsg91 smsmsg91 otp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tesark-msg91-php/health.svg)

```
[![Health](https://phpackages.com/badges/tesark-msg91-php/health.svg)](https://phpackages.com/packages/tesark-msg91-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[pantheon-systems/terminus

A command line interface for Pantheon

3391.5M18](/packages/pantheon-systems-terminus)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[tzsk/sms

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

319270.8k6](/packages/tzsk-sms)

PHPackages © 2026

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