Download the PHP package centrifugal/phpcent without Composer
On this page you can find all versions of the php package centrifugal/phpcent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download centrifugal/phpcent
More information about centrifugal/phpcent
Files in centrifugal/phpcent
Package phpcent
Short Description PHP library to communicate with Centrifugo HTTP API
License MIT
Homepage https://github.com/centrifugal/phpcent
Informations about the package phpcent
phpcent
PHP library to communicate with Centrifugo v5 HTTP API (for Centrifugo v4 use phpcent v5.x, for Centrifugo v3 use phpcent v4.x).
Library is published on the Composer: https://packagist.org/packages/centrifugal/phpcent
See Centrifugo server API documentation.
Basic Usage:
You can use phpcent
to create connection token (JWT):
Connection token that will be valid for 5 minutes:
It's also possible to generate channel subscription token:
It's also possible to generate channel subscription token with expiration time, for example token for 30 mins:
Also API key and secret can be set in constructor:
Timeouts:
All available API methods:
To use assoc
option while decoding JSON in response:
SSL
In case if your Centrifugo server has invalid SSL certificate, you can use:
You can also use self signed certificate in safe manner:
Note: Certificate must match with host name in Client
address (localhost
in example above).
DNS Resolution
This error may indicate your system is having trouble resolving IPv6 addresses:
By default, both IPv4 and IPv6 addresses will attempt to be resolved. You can force it to only resolve IPv4 addresses with:
Testing
Requirements:
The provided PHPUnit tests assume that a local Centrifugo server is running and available at port 8000. This can be accomplished using Docker and the official Centrifugo image.
Authors
All versions of phpcent with dependencies
ext-json Version *
ext-curl Version *