定制 xutl/yii2-broadcast 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

xutl/yii2-broadcast

Composer 安装命令:

composer require xutl/yii2-broadcast

包简介

The broadcast queue extension for the Yii framework

README 文档

README

Latest Stable Version Total Downloads Reference Status Build Status Dependency Status License

Installation

Next steps will guide you through the process of installing yii2-broadcast using composer. Installation is a quick and easy three-step process.

Install component via composer

Either run

composer require --prefer-dist xutl/yii2-broadcast

or add

"yuncms/yii2-broadcast": "~1.0.0"

to the require section of your composer.json.

Configuring your application

Add following lines to your main configuration file:

'components' => [
    'broadcast' => [
        'class' => 'xutl\broadcast\Broadcast',
        'endPoint' => 'http://abcdefg.mns.cn-hangzhou.aliyuncs.com/',
        'accessId' => '1234567890',
        'accessKey' => '1234567890',
    ],
    //etc
],

Use broadcast

/** @var \xutl\broadcast\Broadcast $broadcast */
$broadcast = Yii::$app->broadcast;

$topicName = 'CreateTopicAndPublishMessageExample';
$broadcast->create($topicName);

$topic = $broadcast->getTopicRef($topicName);
$subscriptionName = "SubscriptionExample";

try{
    $res = $topic->subscribe($subscriptionName,'https://www.baidu.com','test.test');
    echo "SubscriptionCreated! \n";
}catch (MnsException $e){
    echo "CreateSubscriptionFailed: " . $e;
    return;
}

$messageBody = "test";
$res = $topic->publishMessage($messageBody, 'test.test');
var_dump($res);
class ApiController extends \yii\web\Controller
{
    public function actions()
    {
        return [
            /**
             * Returns an access token.
             */
            'callback' => [
                'class' => \xutl\broadcast\TopicAction::classname(),
                'callback'=>[$this, 'callback'],
            ],
        ];
    }
    
    /**
     * 
     */
    public function callback($params)
    {
        print_r($params);
    }
}

License

This is released under the MIT License. See the bundled LICENSE.md for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固