PHP code example of hosannahighertech / yii2-sms

1. Go to this page and download the library: Download hosannahighertech/yii2-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/ */

    

hosannahighertech / yii2-sms example snippets


$sms = new \hosannahighertech\sms\senders\BeemSender([
  'key' => 'YOUR_KEY_FROM_BEEM
      'secret' => 'YOUR_SECRET_HERE',
  ]);

 $sms->send('SENDER_NAME_OR_NUMBER', ['255....', '255....'], 'Hi, Test Message from Yii2 SMS');

$sms = new \hosannahighertech\sms\senders\BeemSender([
  'key' => 'YOUR_KEY_FROM_BEEM
      'secret' => 'YOUR_SECRET_HERE',
  ]);
  
  $sender->on(SmsSenderInterface::EVENT_BEFORE_SEND, function (SMSEvent $event) {
      $event->message; //this is SMS Object that was sent to the server. Handy to log things if you turned off loggin
  });
  
  $sender->on(SmsSenderInterface::EVENT_AFTER_SEND, function (SMSEvent $event) {
      $event->message; //this is data that comes from backend. For Beem, it is request_id
  });

 $sms->send('SENDER_NAME_OR_NUMBER', ['255....', '255....'], 'Hi, Test Message from Yii2 SMS');