simialbi/yii2-websms-com 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

simialbi/yii2-websms-com

Composer 安装命令:

composer require simialbi/yii2-websms-com

包简介

A PHP-client-library for using websms.com SMS services with yii2 framework.

README 文档

README

A lightweight PHP-client-library for using websms.com SMS services with yii2 framework. Reduces the complexity of network-communication between client and SMS gateway, to help save time and money for focusing on their business logic.

Latest Stable Version Total Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require --prefer-dist simialbi/yii2-websms-com

or add

"simialbi/yii2-websms-com": "^1.0.0"

to the require section of your composer.json.

Usage

In order to use this component, you will need to:

  1. Setup component your application so that the module is available.

Setup component

return [
    // [...]
    'components' => [
        'sms' => [
            'class' => 'simialbi\yii2\websms\Connection',
            'baseUrl' => 'https://api.websms.com',
            'token' => '<your api token>',
            'sendUrl' => '/rest/smsmessaging/simple'
        ]
    ]
];

Example Usage

To send a message create a new Message instance and set at least the content and recipients.

<?php
 /** @var \simialbi\yii2\websms\Connection $sms */
$sms = Yii::$app->get('sms', true);
$message = $sms->createMessage();
$message
    ->id('my-test-id-' . uniqid())
    ->category($message::CATEGORY_INFORMATIONAL)
    ->content("This is a test\nwith multpile lines")
    ->type($message::MESSAGE_TYPE_TEXT)
    ->addRecipient('4367612345678');
$response = $message->send();

if ($response->isOk) {
    echo 'success';
} else {
    echo 'failure';
}

License

yii2-websms-com is released under MIT license. See bundled LICENSE for details.

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固