2017 © Pedro Peláez
 

yii2-component yii2-sms

Yii2 component for sending SMS messages

image

miserenkov/yii2-sms

Yii2 component for sending SMS messages

  • Sunday, March 19, 2017
  • by miserenkov
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,351 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

Yii2 Sms component

Yii2 component for sending SMS messages through Smsc, (*1)

License Latest Stable Version Latest Unstable Version Total Downloads Build Status, (*2)

Support

GitHub issues., (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

php composer.phar require --prefer-dist miserenkov/yii2-sms "^1.0"

or add, (*6)

"miserenkov/yii2-sms": "^1.0"

to the require section of your composer.json file., (*7)

Configuration

To use sender, you should configure it in the application configuration like the following, (*8)

'components' => [
    ...
    'sms' => [
        'class' => 'miserenkov\sms\Sms',
        'gateway' => 'smsc.ua',     // gateway, through which will sending sms, default 'smsc.ua'
        'login' => '',              // login
        'password' => '',           // password or lowercase password MD5-hash
        'senderName' => '',         // sender name
        'options' => [
            'useHttps' => true,     // use secure HTTPS connection, default true
        ],
    ],
    ...
],

Available gateways

\miserenkov\sms\Sms::GATEWAY_UKRAINE,     // smsc.ua
\miserenkov\sms\Sms::GATEWAY_RUSSIA,      // smsc.ru
\miserenkov\sms\Sms::GATEWAY_KAZAKHSTAN,  // smsc.kz
\miserenkov\sms\Sms::GATEWAY_TAJIKISTAN,  // smsc.tj
\miserenkov\sms\Sms::GATEWAY_UZBEKISTAN,  // smsc.uz
\miserenkov\sms\Sms::GATEWAY_WORLD,       // smscentre.com

Messages logging

'components' => [
    ...
    'sms' => [
        ...
        'logging' => [
            'class' => '',          // optionaly, default to miserenkov\sms\logging\Logger
            'connection' => 'db'    // string or array to database connection
            'tableName' => ''       // database table name, optionaly, default to {{%sms_log}}
        ],
        ...
    ],
    ...
],

Basic usages

Get balance

/**
 * return an float in case of successful or false in case of error 
 */
Yii::$app->sms->getBalance();

Sending message

/**
 * $phones an string for single number or array for multiple numbers
 * $message an string
 *
 * return an string sms identifier in case successful or false in case error
 */
Yii::$app->sms->send($phones, $message);

Get message status

/**
 * $id sms identifier
 * $phone phone number of recipient
 *
 * return an array [
 *      status           - status code
 *      status_message   - status message
 *      err              - error code
 *      err_message      - error message
 *      send_time        - timestamp of send
 *      cost             - message cost
 *      operator         - recipient operator
 *      region           - recipient region
 * ] in case successful or false in case error
 */
Yii::$app->sms->getStatus($id, $phone);

The Versions

19/03 2017

dev-master

9999999-dev

Yii2 component for sending SMS messages

  Sources   Download

MIT

The Requires

 

The Development Requires

by Misha Serenkov

yii2 sms smsc smsc.ru smsc.ua

19/03 2017

v1.1

1.1.0.0

Yii2 component for sending SMS messages

  Sources   Download

MIT

The Requires

 

The Development Requires

by Misha Serenkov

yii2 sms smsc smsc.ru smsc.ua

14/12 2016

dev-queue

dev-queue

Yii2 component for sending SMS messages

  Sources   Download

MIT

The Requires

 

The Development Requires

by Misha Serenkov

yii2 sms smsc smsc.ru smsc.ua

03/12 2016

v1.0

1.0.0.0

Yii2 component for sending SMS messages

  Sources   Download

MIT

The Requires

 

The Development Requires

by Misha Serenkov

yii2 sms smsc smsc.ru smsc.ua