Download the PHP package zavrik/laravel-centrifugo without Composer
On this page you can find all versions of the php package zavrik/laravel-centrifugo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-centrifugo
Laravel-Centrifugo For Docker
This package is an easier way for use Centrifugo v3 with Laravel Framework and Docker. It realises proxy connections inside docker for trigger events when we have some data in WebSocket Connection.
Install
1) Copy to .env
2) execute command and clear cache. 3) Add to your file this container
Usage
Autogenerate config
Command generate for Laravel and for Centrifugo. It Generates for you default proxy routes by and centrifugo keys.
Security
By Default, it uses Laravel Passport Token for identify users and possible to connect Centrifugo. You can write your own Guard by implement .
auth(Request $request): int
Give you Request with body that you can send, and you must return userID by whom WebSocket was connected.
encodeUserId(int $userId): string
Encoding User ID in unique string for security display User ID. By Default in use library.
decodeUserId(string $hashedUserId): int
Decoding Hashed User ID for correctly setUp User ID in events.
Proxy Events
Centrifugo has 4 proxy routes. We use only 3 of them because of refresh proxy unused by AuthGuard Authentication. You can select which of Users can connect to Centrifugo by Guarding You Application Token.
connect
After Successfully Guarded Your token it dispatches with UserID.
subscribe
Dispatch with UsedID and Channel Name after User successfully subscribed on Channel
publish
Dispatch with UserID, Channel and Published Data after User successfully published data in Channel
FrontEnd usage
You must use default Centrifugo JS library. Example with default BearerToken Connection:
By you can send Any data to you Request Body in AuthGuard.
All versions of laravel-centrifugo with dependencies
ext-bcmath Version *
laravel/framework Version ^8.0.0
centrifugal/phpcent Version ^4.0.0
laravel/passport Version ^v10.2.0
hashids/hashids Version ^4.1