2017 © Pedro Peláez
 

yii2-extension yii2-broadcast

The broadcast queue extension for the Yii framework

image

xutl/yii2-broadcast

The broadcast queue extension for the Yii framework

  • Thursday, August 31, 2017
  • by xutl
  • Repository
  • 0 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

yii2-broadcast

Latest Stable Version Total Downloads Reference Status Build Status Dependency Status License, (*1)

Installation

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

Install component via composer

Either run, (*3)

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

or add, (*4)

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

to the require section of your composer.json., (*5)

Configuring your application

Add following lines to your main configuration file:, (*6)

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

The Versions

31/08 2017

dev-master

9999999-dev

The broadcast queue extension for the Yii framework

  Sources   Download

MIT

The Requires

 

by X TL

yii2 queue aliyun broadcast

21/08 2017

1.0.4

1.0.4.0

The broadcast queue extension for the Yii framework

  Sources   Download

MIT

The Requires

 

by X TL

yii2 queue aliyun broadcast

21/08 2017

1.0.3

1.0.3.0

The broadcast queue extension for the Yii framework

  Sources   Download

MIT

The Requires

 

by X TL

yii2 queue aliyun broadcast

21/08 2017

1.0.2

1.0.2.0

The broadcast queue extension for the Yii framework

  Sources   Download

MIT

The Requires

 

by X TL

yii2 queue aliyun broadcast

21/08 2017

1.0.1

1.0.1.0

The broadcast queue extension for the Yii framework

  Sources   Download

MIT

The Requires

 

by X TL

yii2 queue aliyun broadcast

21/08 2017

1.0.0

1.0.0.0

The broadcast queue extension for the Yii framework

  Sources   Download

MIT

The Requires

 

by X TL

yii2 queue aliyun broadcast