PHP code example of fresh / centrifugo-bundle
1. Go to this page and download the library: Download fresh/centrifugo-bundle 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/ */
fresh / centrifugo-bundle example snippets
# config/bundles.php
return [
// Other bundles...
Fresh\CentrifugoBundle\FreshCentrifugoBundle::class => ['all' => true],
// Other bundles...
];
declare(strict_types=1);
namespace App\Service;
use Fresh\CentrifugoBundle\Service\CentrifugoInterface;
class YourService
{
public function __construct(private readonly CentrifugoInterface $centrifugo)
{
}
public function example(): void
{
$this->centrifugo->publish(['foo' => 'bar'], 'channelName');
}
}