PHP code example of nek-v / yii-esmsc

1. Go to this page and download the library: Download nek-v/yii-esmsc 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/ */

    

nek-v / yii-esmsc example snippets



...
'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'
            )
        )
    )
)
...


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