Download the PHP package rasuvaeff/yii3-centrifugo without Composer

On this page you can find all versions of the php package rasuvaeff/yii3-centrifugo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii3-centrifugo

rasuvaeff/yii3-centrifugo

Stable Version Total Downloads Build Static analysis Psalm Level License Русская версия

Centrifugo v6 integration for Yii3: full HTTP server API client, JWT connection/subscription token issuers, and PSR-15 proxy event handlers (connect, subscribe, publish, refresh, sub_refresh, rpc).

Using an AI coding assistant? llms.txt has a compact API reference you can paste into context.

Requirements

Installation

Then configure in config/params.php:

Usage

Server API Client

CentrifugoClient provides all Centrifugo v6 OSS HTTP API methods. It requires a PSR-18 client and PSR-17 factories to be bound in the DI container.

Method Description
publish(channel, data) Publish to one channel
broadcast(channels, data) Publish to many channels
subscribe(user, channel) Subscribe user server-side
unsubscribe(user, channel) Unsubscribe user server-side
disconnect(user, client?, whitelist?) Disconnect user
refresh(user, client?, expireAt?) Refresh connection
presence(channel) Detailed presence info
presenceStats(channel) Aggregated presence counts
history(channel, limit?, reverse?, since?) Channel message history
historyRemove(channel) Clear channel history
channels(pattern?) List active channels
info() Cluster node info
batch(BatchCommand ...) Multiple commands in one request

JWT Token Issuance

Proxy Events

Centrifugo can proxy connection lifecycle events to your backend over HTTP. Configure endpoints in centrifugo.json:

Register routes in your Yii3 app:

Implement the handler interface in your application:

Bind your handler in the DI container:

Available proxy handlers

Handler interface Action class Centrifugo event
ConnectProxyHandler ConnectAction Client connects
RefreshProxyHandler RefreshAction Connection refresh
SubscribeProxyHandler SubscribeAction Client subscribes to channel
PublishProxyHandler PublishAction Client publishes to channel
SubRefreshProxyHandler SubRefreshAction Subscription refresh
RpcProxyHandler RpcAction Client RPC call

Proxy response types

Type JSON envelope Code range
ProxyResult(array $data) {"result": {...}}
ProxyError(int $code, string $message) {"error": {"code": N, "message": "..."}} 400–1999
ProxyDisconnect(int $code, string $reason) {"disconnect": {"code": N, "reason": "..."}} 4000–4999

Security

Examples

See examples/ for runnable scripts.

Development

No PHP or Composer on the host — all commands run inside composer:2 Docker container.

License

BSD-3-Clause. See LICENSE.md.


All versions of yii3-centrifugo with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.5
lcobucci/jwt Version ^5.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^2.0
psr/http-server-handler Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rasuvaeff/yii3-centrifugo contains the following files

Loading the files please wait ...