innmind / installation-monitor
简单的套接字,用于累积和分发系统事件
3.1.0
2021-02-15 17:05 UTC
Requires
- php: ~7.4|~8.0
- innmind/cli: ~2.0
- innmind/immutable: ~3.5
- innmind/ipc: ~3.0
- innmind/json: ^1.0
- innmind/operating-system: ~2.0
- innmind/silent-cartographer: ~2.0
Requires (Dev)
- innmind/black-box: ^4.16
- innmind/coding-standard: ^1.1
- phpunit/phpunit: ~9.0
- vimeo/psalm: ~4.4
README
一个用于监听并重新分发来自/到其他应用程序的事件的工具。
这在安装应用程序时让应用程序进行自我配置很有用。例如,一个依赖于应用程序A的应用程序B,A可以向这个工具发送一个事件,当B的安装开始时,它可以要求这个工具发送它记录的所有事件。
安装
composer require innmind/installation-monitor
用法
第一步是启动将聚合事件的服务器
installation-monitor oversee --daemon
然后您可以从您的应用程序发送一个类似的事件
use function Innmind\InstallationMonitor\bootstrap; use Innmind\InstallationMonitor\Event; use Innmind\Immutable\{ Map, Sequence, }; $client = bootstrap()['client']['ipc'](); $client->send( new Event( new Event\Name('foo'), $payload = Map::of('string', 'scalar|array') ), new Event( new Event\Name('bar'), $payload = Map::of('string', 'scalar|array') ) // etc... ); // or $client->events(); // Sequence<Event> all the events recorded by the server