Centrifugo (Centrifuge) [2.0+] PHP Server REDIS & HTTP API implementation for Laravel 5.5+
tomchanio/laravel_cent is a Laravel package for centrifugo (centrifuge) [2.0+] php server redis & http api implementation for laravel 5.5+.
It currently has 1 GitHub stars and 471 downloads on Packagist (latest version 1.4).
Install it with composer require tomchanio/laravel_cent.
Discover more Laravel packages by tomchanio
or browse all Laravel packages to compare alternatives.
Last updated
Centrifugo (Centrifuge) [2.0+] PHP Server HTTP API implementation for Laravel 5.5+
composer require tomchanio/laravel_cent & composer updateconfig/centrifugo.php as provided belowconfig/app.php as provided belowconfig/centrifugo.php<?php
return [
'url' => 'http://localhost:8000/api/', // full api url
'secret' => 'skoniksnyashamoyanikamuneotdam', // you super secret key
'apikey' => 'skoniksnyashamoyanikamuneotdam', // you api key
];
config/app.php 'aliases' => [
...
'Centrifugo'=> Tomchanio\Centrifugo\Centrifugo::class,
]
<?php
use Centrifugo;
class Controller
{
public function your_func()
{
// declare Centrifugo
$Centrifugo = new Centrifugo();
// generating token example
$userid = '1337_1448_228';
$info = ['token' => '123'];
$token = $Centrifugo->generateToken($userid, $info);
// publishing example
$Centrifugo->publish("channel" , ["yout text or even what rou want"]);
// each method returns its response;
// list of awailible methods:
$response = $Centrifugo->publish($channle, $messageData);
$response = $Centrifugo->broadcast($channles, $messageData);
$response = $Centrifugo->unsubscribe($channle, $userId);
$response = $Centrifugo->disconnect($userId);
$response = $Centrifugo->presence($channle);
$response = $Centrifugo->presence_stats($channle);
$response = $Centrifugo->history($channle);
$response = $Centrifugo->history_remove($channle);
$response = $Centrifugo->channels();
$response = $Centrifugo->info();
$response = $Centrifugo->generateToken($user);
// You can create a controller to bild your own interface;
}