Skip to content

milan-sahana/mm-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MM SMS

Stable License

A simple library to send SMS using MM Sms Service

Official PHP library for Mail Mantra SMS.

Read up here for getting started and understanding the sms flow with MM Sms: https://sms1.mailmantra.com/v2

Prerequisites

  • A minimum of PHP 7.3 upto 8.3

Installation

  • If your project using composer, run the below command
composer require milan-sahana/mm-sms:1.*

##Note: This PHP library follows the following practices:

  • Namespaced under MilanSahana\MmSms
  • API throws exceptions instead of returning errors
  • Options are passed as an array instead of multiple arguments wherever possible
  • All requests and responses are communicated over JSON

Documentation

Documentation of MM SMS's API and their usage is available at https://sms1.mailmantra.com

Basic Usage

Instantiate the MM Sms instance with auth_key. You can obtain the keys from the dashboard app (https://sms1.mailmantra.com/v2/sender_id/list_all)

use MilanSahana\MmSms\Sms;

$mmSMS = new Sms($auth_key);

The resources can be accessed via the $mmSMS object. All the methods invocations follows the following pattern

    // $mmSMS->function() to access the API
    //Example
    $mmSMS->send('9876543210', '1234 is Your OTP. Do not share with anyone.','123456789101112');

Common Examples

View Balance:

To view your balance

use MilanSahana\MmSms\Sms;

$mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG");

$balance_arr = $mmSMS->balance();

var_dump($balance_arr);
Output:
array(3) {
    ["status"]=>
  int(1)
  ["message"]=>
  string(1) "7"
    ["code"]=>
  string(6) "MMTEST"
}

Send sms:

Send a sms to one or more mobile number(comma seperated mobile numbers)

use MilanSahana\MmSms\Sms;

$mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG");

$send_report = $mmSMS->send('9876543210', '123456 is Your OTP. Do not share with anyone.','12345678901234567890');

var_dump($send_report);
Output:
array(3) {
    ["status"]=>
  int(1)
  ["message"]=>
  string(25) "1 SMS send Successfully.."
    ["code"]=>
  string(24) "346772774568353130393036"
}

Send Bulk sms:

Send a sms to one or more mobile number(comma seperated mobile numbers)

use MilanSahana\MmSms\Sms;

$mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG");

$sms = [
    [
        'message' =>'1234 Your OTP. Do not share with anyone.',
        'to'=>[
            '9999999999',
            '8888888888',
        ]
    ],
    [

        'message' =>'56789 Your OTP. Do not share with anyone.',
        'to'=>[
            '7777777777',
            '9876543210'
        ]
    ],
];

$send_bulk_report = $mmSMS->sendBulk($sms, '12345678901234567890');

var_dump($send_bulk_report);
Output:
array(3) {
    ["status"]=>
  int(1)
  ["message"]=>
  string(25) "4 SMS send Successfully.."
    ["code"]=>
  string(24) "346772774163393934343834"
}

Changelog

Version 1.0.1 provided by milan-sahana - Testing

  • Cleaned Up Code
  • Fixed Bugs
  • A minimum of PHP 7.3
  • Added Option to prevent json error
Version 1.0.0 - Stable Release
  • View Balance
  • Added Send SMS in Bulk
  • Fixed issue Send SMS
  • Update extras array
  • Updating version pattern.
x.y.z
x = Main version of the plugin
y = New features were added to the plugin
z = Fixes/patches to existing features of the plugin

License

The Razorpay PHP SDK is released under the MIT License. See LICENSE file for more details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages