PHP code example of betsuno / yii2-centrifugo

1. Go to this page and download the library: Download betsuno/yii2-centrifugo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

betsuno / yii2-centrifugo example snippets


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

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