Giter Club home page Giter Club logo

centrifugobundle's Introduction

CentrifugoBundle

๐Ÿ“ฆ Provides communication with web-socket server Centrifugo in Symfony applications.

Scrutinizer Quality Score Build Status CodeCov License Latest Stable Version Total Downloads StyleCI Gitter

Features ๐ŸŽ

Requirements ๐Ÿง

  • PHP >= 8.2
  • Symfony 7.0

Installation ๐ŸŒฑ

$ composer req fresh/centrifugo-bundle
Choose the version you need
Bundle Version (X.Y.Z) PHP Symfony Comment
5.0.* >= 8.2 7.* Current version
4.1.* >= 8.2 6.* 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:publish
  • centrifugo:broadcast
  • centrifugo:subscribe
  • centrifugo:unsubscribe
  • centrifugo:disconnect
  • centrifugo:refresh
  • centrifugo:presence
  • centrifugo:presence-stats
  • centrifugo:history
  • centrifugo:history-remove
  • centrifugo:channels
  • centrifugo:info

โ„น๏ธ More examples of using console commands

Integration into Symfony Web-Profiler ๐ŸŽ›๏ธ

Autocomplete channels in console commands ๐Ÿช„

Contributing ๐Ÿค

Read the CONTRIBUTING file.

centrifugobundle's People

Contributors

dmnbars avatar fre5h avatar rela589n avatar vladgapanovich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

centrifugobundle's Issues

DateTimeHelper

I faced with an error

Cannot autowire service "Fresh\CentrifugoBundle\Service\Credentials\CredentialsGenerator": argument "$dateTimeHelper" of method "__construct()" references class "Fresh\DateTime\DateTimeHelper" but no such service exists.

a class exists, example copied from documentation, what do I do wrong?

Symfony 5.1

Wrong status code for Centrifugo response

Hello two days ago we started to get 'Wrong status code for Centrifugo response' error.

bundle version - 1.4.0
centrifugo version - 2.8

I just would like to ask is that known issue and may be you know the steps how to solve it and which way to move. Strange thing that all had being working till Wednesday (March, 16 2022)

If the issue is not spread may be you just give us any suggestions.

Thank you a lot for advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.