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

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

craftsys/msg91-php
==================

PHP Client for using Msg91's API to Send OTPs, Verify OTPs, Resend OTPs, Send SMS (Short Message) etc.

v0.15.5(2mo ago)6139.4k↓70.1%61MITPHPPHP &gt;=7.1|^8.0|^8.1|^8.2|^8.3CI failing

Since Oct 18Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/craftsys/msg91-php)[ Packagist](https://packagist.org/packages/craftsys/msg91-php)[ Docs](https://github.com/craftsys/msg91-php)[ RSS](/packages/craftsys-msg91-php/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (36)Used By (1)

Msg91 REST API client for PHP
=============================

[](#msg91-rest-api-client-for-php)

### Sponsor

[](#sponsor)

  [![](https://avatars1.githubusercontent.com/u/66683304?s=50&v=4)](https://sembark.com?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=msg91-php&utm_content=sembark)  **Sembark Tech.**
 Manage and grow your travel business with Sembark's software solutions. Click [here](https://sembark.com?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=msg91-php&utm_content=sembark) to learn more. [![Total Downloads](https://camo.githubusercontent.com/308e7a8a07feefc3e40f34f68272ce78cb611fc9a1cc6686a3f1e258289c3304/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63726166747379732f6d736739312d706870)](https://packagist.org/packages/craftsys/msg91-php)[![Latest Stable Version](https://camo.githubusercontent.com/0f43133d26ee06fae18ad4525a8a43ffccb351ddfcd39fa517eefa00e77e81d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63726166747379732f6d736739312d7068703f6c6162656c3d76657273696f6e)](https://packagist.org/packages/craftsys/msg91-php)[![License](https://camo.githubusercontent.com/ef7b67706371a955d0551be17adfa8ba3b5975434201db6712e1f266e23cc533/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f63726166747379732f6d736739312d706870)](https://packagist.org/packages/craftsys/msg91-php)[![Status](https://github.com/craftsys/msg91-laravel/actions/workflows/test.yml/badge.svg)](https://github.com/craftsys/msg91-laravel/actions/workflows/test.yml)

*This library requires a minimum PHP version of 7.1*

This is a **PHP Client** for [Msg91 APIs](https://docs.msg91.com/collection/msg91-api-integration/5/pages/139). Before using it, please make sure you have an account on [Msg91](https://msg91.com/) and have an **Authkey** (Msg91 Dashboard &gt; API &gt; Configure).

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Create a Client](#create-a-client)
    - [Configuration](#configuration)
    - [OTP and SMS Services](#otp-and-sms-services)
- [Examples](#examples)
    - [Managing OTPs](#managing-otps)
        - [Send OTP](#send-otp)
        - [Verify OTP](#verify-otp)
        - [Resend OTP](#resend-otp)
    - [Sending SMS](#sending-sms)
        - [Message Variables](#message-variables)
        - [Receiver Key](#receiver-key)
    - [Handling Responses](#handling-responses)
- [Related](#related)
- [Acknowledgements](#acknowledgements)

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

[](#installation)

The packages is available on [Packagist](https://packagist.org/packages/craftsys/msg91-php) and can be installed via [Composer](https://getcomposer.org/) by executing following command in shell.

```
composer require craftsys/msg91-php
```

Usage
-----

[](#usage)

If you're using Composer, make sure the autoloader is included in your project's bootstrap file:

```
require_once "vendor/autoload.php";
```

Now the client can be initialised by passing a [configured](#configuration) object to the constructor.

```
$config = [
  'key' => "123456789012345678901234",
];
$client = new Craftsys\Msg91\Client($config);
```

The package in distributed under `Craftsys\Msg91` namespace which can used if your are working in a namespace environment.

```
