innmind / installation-monitor
Simple socket to accumulate and dispatch system events
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
Tool to listen and redispatch events from/to other applications.
This is useful to let applications configure themselves when installing them. Take for example an application B that depends on an application A, A can emit an event to this tool and when the installation of B starts it can ask this tool to send it all the events it has recorded.
Installation
composer require innmind/installation-monitor
Usage
First step is to start the server that will aggregate the events:
installation-monitor oversee --daemon
Then from your application you can send an event like so :
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