PHP code example of mail-mantra / sms

1. Go to this page and download the library: Download mail-mantra/sms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mail-mantra / sms example snippets


use MailMantra\Sms\Sms;

$mmSMS = new Sms($auth_key);

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

use MilanSahana\MmSms\Sms;

$mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG");

$balance_arr = $mmSMS->balance();

var_dump($balance_arr);


array(3) {
    ["status"]=>
  int(1)
  ["message"]=>
  string(1) "7"
    ["code"]=>
  string(6) "MMTEST"
}


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);

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

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);

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