sorokinmedia/yii2-centrifugo

Centrifugo component for Yii2 framework

Installs: 9 157

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 3

Open Issues: 0

Type:yii2-extension

dev-master 2020-01-04 12:10 UTC

This package is auto-updated.

Last update: 2024-11-04 23:08:59 UTC


README

Total Downloads

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]);