eislambey / wsify
PHP client for wsify
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/eislambey/wsify
Requires
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpstan/phpstan: ^0.11.12
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2025-10-13 03:06:21 UTC
README
PHP Client for Wsify realtime messaging server.
What is Wsify?
Just a tiny, simple and realtime pub/sub messaging service
For more information please see official repo: https://github.com/alash3al/wsify
Installation
composer require eislambey/wsify
Examples
Publish a message to all subscribers
<?php $uri = 'http://localhost:4040/publish'; $publisher = new \Wsify\Publisher($uri); $publisher->publish('channel_name', 'a message to sent');
Send a message to an user
<?php $uri = 'http://localhost:4040/publish'; $publisher = new \Wsify\Publisher($uri); $publisher->publish('channel_name', 'a message to sent', ['user_key']);
Using webhooks
<?php $events = new \Wsify\Events(); $events->onConnect(function (object $payload){ // `$payload->action` and `$payload->key` available }); $events->onDisconnect(function (object $payload){ // `$payload->action` and `$payload->key` available }); $events->onSubscribe(function (object $payload){ // `$payload->action`, `$payload->channel` and `$payload->key` available }); $events->onUnsubscribe(function (object $payload){ // `$payload->action`, `$payload->channel` and `$payload->key` available }); $events->listen();
Test
WSIFY_PUBLISH_URL='http://localhost:4040/publish' composer test
License
The MIT License. See LICENSE