PHP code example of ostashevdv / yii2-smsimple

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

    

ostashevdv / yii2-smsimple example snippets


return [
  ...
  'components' => [
    'sms' => [
      'class' => '\ostashevdv\smsimple\SMSimple',
      'username' => 'Ваше имя пользователя в smsimple.ru',
      'password' => 'Ваш пароль',
      'origin_id' => 'Подпись по умолчанию (имя отправителя)'
    ]
  ],
]

try {
  Yii::$app->sms->connect();
  Yii::$app->sms->send('7-123-123-12-12', 'hello world');
} catch(\ostashevdv\smsimple\SMSimpleException $e) {}

try {
  Yii::$app->sms->connect();
  Yii::$app->sms->send(['7-111-111-11-11', '72222222222', '83333333333'], 'foo');
  $message_id = Yii::$app->sms->send('74441111111, 7-111-111-11-11, 82222222222', 'bar');
} catch(\ostashevdv\smsimple\SMSimpleException $e) {}

$status = Yii::$app->sms->check_delivery($message_id);