bariew/yii2-pusher

yii2 web push for pusher.com

Installs: 88

Dependents: 0

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

Type:helpers

0.1.1 2016-04-11 12:21 UTC

README

INSTALL

php composer.phar require bariew/yii2-pusher

USAGE

1.  Add a new component into yor config file:
'components' => [
    'webpusher' => [
        'class' => 'bariew\yii2Pusher\Component',
        'app_id' => '***', // get your credentials on pusher.com
        'key' => '***',
        'secret' => '***',
    ]
]
2.  Include a widget into your view file e.g. "main.php":
    <?= \bariew\yii2Pusher\Widget::widget(['events' => [
        'notification' => new \yii\web\JsExpression("function(data){console.log(data);}")
    ]]) ?>
3.  Now you can send a notification to any user or an array of users:
Yii::$app->webpusher->userPush("hello user", [Yii::$app->user->id]);