PHP code example of daixianceng / yii2-smser

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

    

daixianceng / yii2-smser example snippets


return [
    'components' => [
        'smser' => [
            // 中国云信
            'class' => 'daixianceng\smser\CloudSmser',
            'username' => 'username',
            'password' => 'password',
            'fileMode' => false
        ]
    ],
];

return [
    'components' => [
        'smser' => [
            // 云片网
            'class' => 'daixianceng\smser\YunpianSmser',
            'apikey' => '9b11127a9701975c734b8aee81ee3526', // 请替换成您的apikey
            'fileMode' => false
        ]
    ],
];

Yii::$app->smser->send('15000000000', '短信内容');

// 发送模板短信
Yii::$app->smser->sendByTemplate('15000000000', ['123456'], 1);

$ php composer.phar