A sms extension for yii2 frameworks

Installs: 177

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2016-06-01 06:18 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:58:00 UTC


README

This is a sms extension of Yii2 framewoks.

It can be used to send sms with different service providers in an easy way.

SMS Service Providers list:

创蓝(Chuanglan):koenigseggposche\sms\target\ChuanglanTarget
国都(Guodu):koenigseggposche\sms\target\GuoduTarget

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require koenigseggposche/yii2-sms "dev-master"

or add

"koenigseggposche/yii2-sms": "dev-master"

to the require section of your composer.json file.

Usage

Configure Yii2 component:

[
    'components' => [
        'sms' => [
            'class' => 'koenigseggposche\sms\Sms',
            'targets' => [
                [
                    'class' => 'koenigseggposche\sms\target\ChuanglanTarget',
                ],
                [
                    'class' => 'koenigseggposche\sms\target\GuoduTarget',
                ],
            ],
        ],
    ],
];

Configure Yii2 param:

[
    'chuanglan' => [
        'url' => 'http://222.73.117.158/msg/HttpBatchSendSM',
        'account' => 'YOUR_ACCOUNT',
        'pswd' => 'YOUR_PASSWORD',
    ],
    'guodu' => [
        'url' => 'http://221.179.180.158:9008/HttpQuickProcess/submitMessageAll',
        'OperID' => 'YOUR_ACCOUNT',
        'OperPass' => 'YOUR_PASSWORD',
    ],
];

Send sms:

<?php
    $mobile = '13500000000';
    $message = 'test message';
    Yii::$app->sms->send($mobile, $message);
?>