friendsofhyperf/ipc-broadcaster

IPC broadcaster component for Hyperf.

v3.1.48 2024-12-01 05:09 UTC

This package is auto-updated.

Last update: 2024-12-04 02:41:54 UTC


README

Latest Version Total Downloads GitHub license

Ipc Broadcaster component for Hyperf.

Installation

  • Installation
composer require friendsofhyperf/ipc-broadcaster

Usage

  • Closure
use function FriendsOfHyperf\IpcBroadcaster\broadcast;

broadcast(function () {
    echo 'Hello world';
});
  • Class
namespace App\Broadcasting;

class FooMessage extends IpcMessage
{
    public function __construct(private string $foo)
    {
        //
    }

    public function handle(): void
    {
        echo $this->foo;
    }
}

use function FriendsOfHyperf\IpcBroadcaster\broadcast;

broadcast(new FooMessage('bar'));

Contact

License

MIT