CentrifugoBundle
đĻ Provides communication with web-socket server Centrifugo in Symfony applications.
Install / Use
/learn @fre5h/CentrifugoBundleREADME
CentrifugoBundle
đĻ Provides communication with web-socket server Centrifugo in Symfony applications.
Features đ
- [x] Compatible with Centrifugo 5.4.7 đ
- [x] Wrapper over Centrifugo HTTP API đ
- [X] Authentication with JWT token (HMAC algorithm) for anonymous, authenticated user and private channel đī¸
- [x] Batch request in JSON streaming format đĒ
- [x] Console commands âī¸ī¸
- [x] Integration into Symfony Web-Profiler đī¸
Requirements đ§
- PHP >= 8.4
- Symfony >= 7.4
Installation đą
$ composer req fresh/centrifugo-bundle
Choose the version you need
| Bundle Version (X.Y.Z) | PHP | Symfony | Comment |
|:----------------------:|:--------:|:-------:|:--------------------|
| 6.4.* | >= 8.4 | >=7.4 | Current version |
| 6.3.* | >= 8.3 | 7.* | Previous version |
By default, Symfony Flex adds this bundle to the config/bundles.php file and adds required environment variables into .env file.
In case when you ignored contrib-recipe during bundle installation it would not be done. Then you have to do this manually.
Check the config/bundles.php file
# config/bundles.php
return [
// Other bundles...
Fresh\CentrifugoBundle\FreshCentrifugoBundle::class => ['all' => true],
// Other bundles...
];
Check the .env file and add you configuration
# .env
###> fresh/centrifugo-bundle ###
CENTRIFUGO_API_KEY=secret-api-key
CENTRIFUGO_API_ENDPOINT=http://localhost:8000/api
CENTRIFUGO_SECRET=secret
###< fresh/centrifugo-bundle ###
CENTRIFUGO_API_KEY should be the same value as option api_key in your Centrifugo config file.
CENTRIFUGO_SECRET should be the same value as option token_hmac_secret_key in your Centrifugo config file.
âšī¸ Customize bundle configuration
Using đ§âđ
Centrifugo service
<?php
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');
}
}
âšī¸ More examples of using Centrifugo service
Authentication with JWT tokens đī¸
Console commands âī¸
centrifugo:publishcentrifugo:broadcastcentrifugo:subscribecentrifugo:unsubscribecentrifugo:disconnectcentrifugo:refreshcentrifugo:presencecentrifugo:presence-statscentrifugo:historycentrifugo:history-removecentrifugo:channelscentrifugo:info
âšī¸ More examples of using console commands
Integration into Symfony Web-Profiler đī¸

Autocomplete channels in console commands đĒ

Contributing đ¤
Read the CONTRIBUTING file.
Related Skills
canvas
352.5kCanvas Skill Display HTML content on connected OpenClaw nodes (Mac app, iOS, Android). Overview The canvas tool lets you present web content on any connected node's canvas view. Great for: -
node-connect
352.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
