geksor/yii2-centrifugal

Centrifugo component for Yii2 framework

dev-master 2019-05-21 14:42 UTC

This package is auto-updated.

Last update: 2024-04-22 01:45:18 UTC


README

There is a wrapper for Centrifugo client based on PHPCent

Installation

Run command in shell

> composer require geksor/yii2-centrifugal "dev-master"

or add this line in to the require section of the composer.json file in your project

"geksor/yii2-centrifugal": "dev-master"

Setup

Add into your config file as following

'components' => [
	...
	'centrifugo' => [
		'class'  => 'yii2\centrifugo\Client',
		'host'   => 'http://localhost:8000',
		'secret' => 'very-long-secret-key',
		'apiKey' => 'very-long-api-key',
		// also you can specify your own transport class as below
		'transport' => [
			'class' => 'your\transport\ClassName',
			...
		]
	],
	...
]

Usage

Yii::$app->centrifugo->publish('test', ['message' => 'hello world']);