PHPackages                             slivka-b/laravel-centrifugo - 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. [API Development](/categories/api)
4. /
5. slivka-b/laravel-centrifugo

ActiveLibrary[API Development](/categories/api)

slivka-b/laravel-centrifugo
===========================

Centrifugo broadcaster for laravel 6.20.26-8 and Centrifugo &gt;= 2.8.1

1.0.0(3y ago)085MITPHPPHP ^7.4|^8.0|^8.1

Since Mar 21Pushed 3y agoCompare

[ Source](https://github.com/SviatoslavBereznitskyi/laravel-centrifugo)[ Packagist](https://packagist.org/packages/slivka-b/laravel-centrifugo)[ Docs](https://github.com/denis660/laravel-centrifugo)[ RSS](/packages/slivka-b-laravel-centrifugo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Documentation **EN** | [RU](https://github.com/denis660/laravel-centrifuge/blob/master/README_RU.md)

Laravel + Centrifugo
====================

[](#laravel--centrifugo)

Centrifugo broadcast driver for Laravel 8.75.0 - 9
---------------------------------------------------

[](#centrifugo-broadcast-driver-for-laravel-8750---9-)

[![Build Status](https://camo.githubusercontent.com/ea0f5be06e745c1a04ccc6bb66c9f89627fce027f7747d180c0c3062809c4794/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656e69733636302f6c61726176656c2d63656e7472696675676f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/denis660/laravel-centrifugo)[![Latest Version](https://camo.githubusercontent.com/5b3e1f3941c29b314d258b01b54413d6d9ff36f120c9ce00c29511491835b9e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f64656e69733636302f6c61726176656c2d63656e7472696675676f2e7376673f7374796c653d666c61742d737175617265)](https://github.com/denis660/laravel-centrifugo/releases)[![Quality Score](https://camo.githubusercontent.com/5299ae3a41e8ecddb7b815b77ad4c5201b688e86fe64c83ef6d124b1a651478e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f64656e69733636302f6c61726176656c2d63656e7472696675676f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/denis660/laravel-centrifugo)[![StyleCI](https://camo.githubusercontent.com/9778c56a49f1b5c522f7e9dd52f9fad3b30bd2142a326c94b412a921182f5141/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3332343230323231322f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/324202212)[![Total Downloads](https://camo.githubusercontent.com/67b62e6373af83aa1402f183721b13ee44f665578afb00374cad49b60975f626/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64656e69733636302f6c61726176656c2d63656e7472696675676f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/denis660/laravel-centrifugo)[![Software License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/denis660/Centrifuge/blob/master/LICENSE)

Introduction
------------

[](#introduction)

Centrifugo broadcaster for laravel , based on:

- [LaraComponents/centrifugo-broadcaster](https://github.com/LaraComponents/centrifugo-broadcaster)
- [centrifugal/phpcent](https://github.com/centrifugal/phpcent)

Features
--------

[](#features)

- Compatible with latest [Centrifugo 3.2.0](https://github.com/centrifugal/centrifugo/releases/tag/v3.2.0) 🚀
- Wrapper over [Centrifugo HTTP API](https://centrifugal.dev/docs/server/server_api) 🔌
- Authentication with JWT token (HMAC algorithm) for anonymous, authenticated user and private channel 🗝️

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4 , 8.0, 8.1
- Laravel 8.75.0 - 9.0
- guzzlehttp/guzzle 6 - 7
- Centrifugo Server 3.2.0 or newer (see [here](https://github.com/centrifugal/centrifugo))

Installation
------------

[](#installation)

Require this package with composer:

```
composer req denis660/laravel-centrifugo
```

Open your config/app.php and add the following to the providers array:

```
'providers' => [
    // And uncomment BroadcastServiceProvider
    App\Providers\BroadcastServiceProvider::class,
],
```

Open your config/broadcasting.php and add new connection like this:

```
        'centrifugo' => [
            'driver' => 'centrifugo',
            'token_hmac_secret_key'  => env('CENTRIFUGO_TOKEN_HMAC_SECRET_KEY',''),
            'api_key'  => env('CENTRIFUGO_API_KEY',''),
            'url'     => env('CENTRIFUGO_URL', 'http://localhost:8000'), // centrifugo api url
            'verify'  => env('CENTRIFUGO_VERIFY', false), // Verify host ssl if centrifugo uses this
            'ssl_key' => env('CENTRIFUGO_SSL_KEY', null), // Self-Signed SSl Key for Host (require verify=true)
        ],
```

Also you should add these two lines to your .env file:

```
CENTRIFUGO_TOKEN_HMAC_SECRET_KEY=token_hmac_secret_key-from-centrifugo-config
CENTRIFUGO_API_KEY=api_key-from-centrifugo-config
CENTRIFUGO_URL=http://localhost:8000

```

These lines are optional:

```
CENTRIFUGO_SSL_KEY=/etc/ssl/some.pem
CENTRIFUGO_VERIFY=false

```

Don't forget to change `BROADCAST_DRIVER` setting in .env file!

```
BROADCAST_DRIVER=centrifugo

```

Basic Usage
-----------

[](#basic-usage)

To configure Centrifugo server, read [official documentation](https://centrifugal.dev)

For broadcasting events, see [official documentation of laravel](https://laravel.com/docs/8.x/broadcasting)

A simple client usage example:

```
