PHPackages                             fresh/centrifugo-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. fresh/centrifugo-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

fresh/centrifugo-bundle
=======================

Provides communication with web-socket server Centrifugo in Symfony applications.

6.4.0(5mo ago)83375.3k—9.3%8MITPHPPHP &gt;=8.4CI failing

Since May 8Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/fre5h/CentrifugoBundle)[ Packagist](https://packagist.org/packages/fresh/centrifugo-bundle)[ Docs](https://github.com/fre5h/CentrifugoBundle)[ GitHub Sponsors](https://github.com/fre5h)[ RSS](/packages/fresh-centrifugo-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (21)Versions (41)Used By (0)

CentrifugoBundle
================

[](#centrifugobundle)

📦 Provides communication with web-socket server [Centrifugo](https://centrifugal.dev) in [Symfony](https://symfony.com) applications.

[![Scrutinizer Quality Score](https://camo.githubusercontent.com/345eb58e1d20ce3ae49ad1547bcf635713a5b6f7636100914b8b2d2a8958bb24/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f66726535682f43656e7472696675676f42756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/fre5h/CentrifugoBundle/)[![Build Status](https://camo.githubusercontent.com/1a0d63126ab22f91803bd7b9474d82b4cb36f1745b05b2ba079df83d1d57592f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66726535682f43656e7472696675676f42756e646c652f63692e79616d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/fre5h/CentrifugoBundle/actions?query=workflow%3ACI+branch%3Amain+)[![CodeCov](https://camo.githubusercontent.com/6bb09d10cdc78763c333d5c84e0e5d867d27a5f2f3e3a5e462b9e61fb1448525/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f66726535682f43656e7472696675676f42756e646c652e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/fre5h/CentrifugoBundle)[![License](https://camo.githubusercontent.com/470a39a460ffaa195b9f7cd978a599d9fd7924799b0f5e85495b58479594b0bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66726573682f63656e7472696675676f2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fresh/centrifugo-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/f9a8e16b77cf491d164abf3e2c0b6f2ff9c25e780bf35d57b8045453d598c48e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66726573682f63656e7472696675676f2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fresh/centrifugo-bundle)[![Total Downloads](https://camo.githubusercontent.com/a3899b69feb2108ab874df163602853704b97478da1669b5796c5dac23e5033e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66726573682f63656e7472696675676f2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fresh/centrifugo-bundle)[![StyleCI](https://camo.githubusercontent.com/4a596587d632806d90e7a9ff68577a344135f0d87debb1979231c7c35a0ee7f1/68747470733a2f2f7374796c6563692e696f2f7265706f732f3136343833343830372f736869656c643f7374796c653d666c61742d737175617265)](https://styleci.io/repos/164834807)[![Gitter](https://camo.githubusercontent.com/38615bd37fa667fefc3415d970da6c8f0de8796527cb97a89dfc59435f3189bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769747465722d6a6f696e253230636861742d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://gitter.im/fre5h/CentrifugoBundle)

Features 🎁
----------

[](#features-)

- Compatible with [Centrifugo 5.4.7](https://github.com/centrifugal/centrifugo/releases/tag/v5.4.7) 🚀
- Wrapper over [Centrifugo HTTP API](https://centrifugal.dev/docs/server/server_api#http-api) 🔌
- Authentication with JWT token (HMAC algorithm) for [anonymous](./Resources/docs/authentication.md#anonymous), [authenticated user](./Resources/docs/authentication.md#authenticated-user) and [private channel](./Resources/docs/authentication.md#private-channel) 🗝️
- [Batch request](./Resources/docs/centrifugo_service_methods.md#batch-request) in [JSON streaming format](https://en.wikipedia.org/wiki/JSON_streaming) 💪
- [Console commands](./Resources/docs/console_commands.md "Console commands") ⚒️️
- Integration into Symfony Web-Profiler 🎛️

Requirements 🧐
--------------

[](#requirements-)

- PHP &gt;= 8.4
- Symfony &gt;= 7.4

Installation 🌱
--------------

[](#installation-)

```
$ composer req fresh/centrifugo-bundle
```

##### Choose the version you need

[](#choose-the-version-you-need)

Bundle Version (X.Y.Z)PHPSymfonyComment`6.4.*``>= 8.4``>=7.4`**Current version**`6.3.*``>= 8.3``7.*`Previous versionBy default, [Symfony Flex](https://symfony.com/doc/current/setup/flex.html) 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

[](#check-the-configbundlesphp-file)

```
# config/bundles.php

return [
    // Other bundles...
    Fresh\CentrifugoBundle\FreshCentrifugoBundle::class => ['all' => true],
    // Other bundles...
];
```

#### Check the `.env` file and add you configuration

[](#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](./Resources/docs/configuration.md "Customize bundle configuration")

Using 🧑‍🎓
---------

[](#using-‍)

### Centrifugo service

[](#centrifugo-service)

```
