bariew/yii2-pusher

yii2 web push for pusher.com

Installs: 234

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 1

Type:helpers

0.1.1 2016-04-11 12:21 UTC

This package is auto-updated.

Last update: 2024-11-16 15:31:33 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]);