esmsc SMS send extension

Yii SMS send extension

  1. Installation
  2. Usage

Latest Stable Version License

This extension is designed to send sms messages through different services and protocols. You can add your providers extending class `ESMSCProvider`. See the examples in the directory `providers`

Resources
Requirements
  • PHP 5.3+
  • Yii 1.1 or above

Installation

  • Configure your composer.json as in the example below
...
"require": {
    "php-smpp/php-smpp": "dev-master",
    "nek-v/yii-esmsc": "1.0.2"
}
...
  • In your protected/config/main.php, add the following:
<?php
...
'aliases' => array(
    // Path to vendor dir
    'vendor'    => realpath(__DIR__ . '/../vendor'),
),
'import'    => array(
    'vendor.nek-v.yii-esmsc.*',
),
'components'    => array(
    'sms'   => array(
        'class' => 'vendor.nek-v.yii-esmsc.ESMSC',
        'provides'  => array(
            'dummy' => array(
                'class' => 'DummyProvider'
            ),
            'smpp'  => array(
                'class'     => 'SMPPProvider',
                'server'    => 'smpp server',
                'port'      => 'smpp port',
                'login'     => 'smpp login',
                'password'  => 'smpp passwod',
                'source'    => 'sender name'
            )
        )
    )
)
...

Usage

<?php
class SiteController extends CController {
    public function actionIndex() {
        $text = 'Hello world!';
        $phone = '1234567891011';
        $provider = Yii::app()->sms;
        // Dummy
        $provider->getInstance('dummy')->send($phone, $text);
        // SMPP
        $provider->getInstance('smpp')->send($phone, $text);
    }
}
0 0
3 followers
0 downloads
Yii Version: 1.1
License: MIT
Category: Web Service
Tags: smpp, sms, texting
Developed by: nek
Created on: Nov 18, 2014
Last updated: 10 years ago

Related Extensions