- Can I install fresh/centrifugo-bundle in a Laravel application?
- No, not as documented. fresh/centrifugo-bundle is a Symfony bundle that registers through config/bundles.php and a DI extension, and Laravel has no bundle loader. The Centrifugo server it talks to is framework-agnostic, so the practical route is to call Centrifugo's HTTP API from a small Laravel service provider or use a Laravel-native client.
- Does this package support Laravel 10 or Laravel 11?
- It does not target Laravel at all; it tracks Symfony major versions and PHP 8.1+. Shared runtime dependencies such as Guzzle/PSR-18 and firebase/php-jwt are already common in Laravel apps, so the incompatibility is lifecycle, not language. Expect to write your own service provider rather than install this package.
- What does fresh/centrifugo-bundle actually do?
- It is a thin Symfony service over Centrifugo's HTTP server API. Application code uses it to publish messages to channels, query presence and history, disconnect users, and generate JWT connection tokens, with connection settings wired through Symfony's DI config.
- How do I publish a real-time event to Centrifugo from Laravel?
- Call Centrifugo's /api/publish endpoint directly with Laravel's HTTP client or Guzzle, sending the API key header and a JSON body with channel and data. Wrap that in a RealtimePublisher interface bound in a service provider so controllers and jobs stay framework-agnostic. The Symfony bundle is not needed for this; it is roughly the same 50 lines of glue.
- How does JWT authentication work between Laravel and Centrifugo?
- Laravel signs a short-lived JWT containing the user identity (sub), expiry, and permitted channel claims; Centrifugo validates it with a shared HMAC secret or an RSA public key configured on the server. Keep the expiry window short and refresh before it lapses, and be careful with channel-prefix claims. This is the one piece worth writing and testing carefully, and it is independent of this bundle.
- Which Centrifugo versions does this bundle support?
- The bundle wraps the HTTP API, which has changed across Centrifugo v4, v5, and v6, and the README does not clearly pin support. Read composer.json and the client code to see which request and response shapes it targets, and run an integration test against the server major you plan to deploy. An abandoned wrapper pinned to an older API surface is the classic failure mode here.
- How much work is porting this Symfony bundle to a Laravel service provider?
- Budget one to two days. The Symfony-specific work is small: a config tree, a service alias, and singleton instantiation, roughly 100 to 200 lines. Replace that with a Laravel config file and a service provider, define a narrow RealtimePublisher interface for publish, broadcast, presence, and history, and keep Centrifugo DTOs out of domain code. The MIT license makes a fork or rewrite straightforward.
- Is fresh/centrifugo-bundle maintained and safe for production use?
- Treat it with caution: bus factor of one, zero dependents, no commercial backing, and no support contract. The risk is concentrated in the thin PHP glue rather than the Centrifugo server, which is mature and widely deployed. Because the code is small and MIT-licensed, a fork or replacement is a half-day task, so the risk is manageable if you isolate it behind your own interface.
- What are the alternatives to this bundle for Laravel real-time messaging?
- Options include a Laravel-native Centrifugo client if one is actively maintained, calling the official Centrifugo HTTP API directly with Guzzle or Laravel's HTTP client, or choosing a different transport such as Laravel Reverb, Pusher, or Soketi if you do not need Centrifugo's specific features. For most Laravel teams the direct HTTP API approach is the cheapest and removes the dependency question entirely.
- How should I test Centrifugo publishing in a Laravel app?
- Bind a fake implementation of your RealtimePublisher interface in the container and assert that publish, broadcast, or presence calls happen without touching the network. Keep one optional integration test, perhaps against a Centrifugo Docker container, to verify request shapes and JWT validation. That gives fast unit tests and a small safety net for server upgrades.