sorokinmedia / yii2-centrifugo
Centrifugo component for Yii2 framework
Installs: 9 286
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 3
Open Issues: 0
Type:yii2-extension
Requires
- centrifugal/phpcent: dev-master
- yiisoft/yii2: >=2.0.30
Requires (Dev)
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-11-04 23:08:59 UTC
README
There is a wrapper for Centrifugo client based on PHPCent
Installation
Run command in shell
> php composer.phar require "sorokinmedia/yii2-centrifugo"
or add this line in to the require
section of the composer.json
file in your project
"sorokinmedia/yii2-centrifugo": "*"
Setup
Add into your config file as following
'components' => [ ... 'centrifugo' => [ 'class' => \sorokinmedia\centrifugo\Client::class, 'host' => 'http://localhost:8000/api', 'secret' => 'very-long-secret-key', 'apikey' => 'very-long-api-ket' ], ... ]
Usage
publish message
Yii::$app->centrifugo->publish('test', ['message' => 'hello world']);
generate jwt token
Yii::$app->centrifugo->generateConnectionToken('5', 0, ['user_id' => 5]);