PHPackages                             emprove/centrifuge-broadcaster - 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. emprove/centrifuge-broadcaster

ActiveLibrary

emprove/centrifuge-broadcaster
==============================

Centrifuge broadcaster for laravel ^6

3.2.3(5y ago)319.3k4MITPHPPHP ^7.2

Since Apr 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/emprove/centrifuge-broadcaster)[ Packagist](https://packagist.org/packages/emprove/centrifuge-broadcaster)[ Docs](https://github.com/emprove/centrifuge-broadcaster)[ RSS](/packages/emprove-centrifuge-broadcaster/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (3)Versions (15)Used By (0)

### Attention! Maybe some diff with IRL.

[](#attention-maybe-some-diff-with-irl)

1. This package forked from "LaraComponents" to fit new Centrifugo v2.
2. Drop Redis support (v2 don't support it), see official [migration guide](https://centrifugal.github.io/centrifugo/misc/migrate/).
3. Update generateToken(user id, timestamp, info) method (v2 uses only jwt auth workflow).

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

[](#introduction)

Centrifuge broadcaster for laravel ^6

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

[](#requirements)

- PHP 7.2+
- Laravel 6+
- Centrifugo Server 2 or newer (see [here](https://github.com/centrifugal/centrifugo))

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

[](#installation)

Require this package with composer:

```
composer require emprove/centrifuge-broadcaster
```

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

```
'providers' => [
    // ...
    Emprove\Centrifugo\CentrifugoServiceProvider::class,

    // And uncomment BroadcastServiceProvider
    App\Providers\BroadcastServiceProvider::class,
],
```

Open your config/broadcasting.php and add the following to it:

```
'connections' => [
    'centrifuge' => [
        'driver'       => 'centrifuge',
        'url'          => env('CENTRIFUGE_URL', 'http://127.0.0.1:8000'),
        'token_ttl'    => env('CENTRIFUGE_TOKEN_TTL', 3600),
        'token_issuer' => env('APP_URL', 'default'),
        'secret'       => env('CENTRIFUGE_SECRET', null),
        'api_key'      => env('CENTRIFUGE_API_KEY', null),
        'ssl_key'      => env('CENTRIFUGE_SSL_KEY', null),
        'verify'       => env('CENTRIFUGE_VERIFY', false),
    ],
    // ...
],
```

You can also add a configuration to your .env file:

```
CENTRIFUGE_API_KEY=very-long-secret-api-key
CENTRIFUGE_SECRET=very-long-secret-key
CENTRIFUGE_URL=http://localhost:8000
CENTRIFUGE_SSL_KEY=/etc/ssl/some.pem
CENTRIFUGE_TOKEN_TTL=3600 # seconds
CENTRIFUGE_VERIFY=false

```

Do not forget to install the broadcast driver

```
BROADCAST_DRIVER=centrifuge

```

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

[](#basic-usage)

To configure the Centrifugo server, read the [official documentation](https://fzambia.gitbooks.io/centrifugal/content)

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

A simple example of using the client:

```
