- How do I install oleh-ozimok/php-centrifugo in a Laravel application?
- Install it with composer require oleh-ozimok/php-centrifugo. There is no Laravel service provider, facade or config file, so you register your own singleton binding in a service provider and pass the Centrifugo HTTP API URL and API key from config. Before installing, run a composer why-not check against your target PHP and Laravel versions, because the 2018 release may pin PHP 7.x and Guzzle 6.
- Is php-centrifugo compatible with Laravel 10 or Laravel 11?
- Not out of the box. The package is framework-agnostic and its last release dates from 2018, so its composer.json likely constrains PHP to 7.0 or 7.1 and Guzzle to version 6, which conflicts with Laravel 9 and later on PHP 8.1+. Verify with composer why-not before planning any work, and do not paper over conflicts with --ignore-platform-reqs.
- Do I need a service provider or facade to use this package in Laravel?
- No provider or facade ships with the package, so you write them yourself. A typical setup is a config file with the Centrifugo API endpoint and key, a singleton binding for the client, and optionally a facade for convenience. Hiding the vendor class behind your own RealtimeBroadcaster interface keeps domain code free of the dependency and makes swapping it later a single-file change.
- How do I publish a message to a Centrifugo channel from Laravel?
- Instantiate the client with your Centrifugo HTTP API URL and key, then call the publish method with a channel name and payload, from a controller, queued job or artisan command. The package also supports publishing to several channels in one call. Remember that the publish call is fire-and-forget: there is no retry, ordering or delivery guarantee, so handle that in your own wrapper if you need it.
- Does php-centrifugo support the Centrifugo v3 and v4 HTTP API?
- Probably not without changes. A 2018 client almost certainly targets Centrifugo's legacy /api endpoint and the v2-era auth header, while current majors expose /api/publish with API-key headers and a revised response envelope, and older majors have dropped the legacy endpoint. The failure mode is a silent 404 or 401 at runtime rather than a compile error, so confirm your deployed Centrifugo major version and test against a real instance before committing.
- How do I query channel presence and history with php-centrifugo?
- The client exposes presence, history and channel info calls that map onto the Centrifugo HTTP API, but they only return data when the Centrifugo server is configured for it, including presence enabled and a non-zero history size for the namespace. Do not assume the PHP package turns these features on, and check that your server version still permits those API calls from your key. Many teams are surprised to find presence and history are server configuration concerns, not client features.
- Does php-centrifugo handle JWT connection tokens and subscription authentication?
- No. Connection authentication and subscription tokens are issued by your backend and validated by Centrifugo according to its server configuration; this library only sends HTTP API calls such as publish. You generate JWTs yourself, typically with firebase/php-jwt, using the same HMAC secret configured in Centrifugo. Treat token issuance and the publish client as two separate concerns in your Laravel app.
- What is the difference between php-centrifugo and centrifugal/phpcent?
- centrifugal/phpcent is the vendor-maintained PHP client and tracks current Centrifugo protocol versions. oleh-ozimok/php-centrifugo has had no upstream release since April 2018, has a single maintainer and no PHP 8 or Guzzle 7 support. If your dependency audit fails, swap the adapter implementation for phpcent or a small hand-rolled Guzzle call behind the same interface.
- How should I test a Centrifugo integration in a Laravel project?
- Unit test your wrapper with a mocked Guzzle handler so you can assert the request path, headers and payload. Add at least one contract test that runs against a dockerized Centrifugo instance pinned to your production version in CI, because only a real server will catch protocol drift such as a removed endpoint or changed auth header. Pin both the Centrifugo server version and the Composer package version and record them in your architecture notes.
- Is php-centrifugo safe to use in production and who maintains it?
- Treat it as unmaintained: no releases since April 2018, roughly 38 stars, one maintainer, and no security response process or PHP 8 support. The risk is concentrated in API drift rather than code quality, so the practical options are forking it in-house or replacing it with a maintained client behind your own interface. Either way, name an engineer who owns that code, because upstream will not fix anything.