automa.net / eventbus
EventBus library
Installs: 6 292
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8.0
- ext-json: *
- psr/container: ^1.0
- ramsey/uuid: ^4.2
Requires (Dev)
- ext-pcntl: *
- ext-sockets: *
- friendsofphp/php-cs-fixer: ^3.13
- php-amqplib/php-amqplib: ^3.7
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^9.5
- symfony/dependency-injection: ^5.4
README
EventBus is a publish/subscribe event bus library.
The library gives the possibility to use multiple events buses at once, to do that use EventBusManager
.
Then you can register separately Domain EventBus and Integration EventBus.
- Required dependency injection container!
Drivers:
- Direct - Instant resolve and dispatch event on handlers.
- RabbitMQ - Publish events on queue and execute them separately using consumers.
Example of RabbitMq driver config:
$config = [ 'host' => INTEGRATION_EVENTBUS_AMQP_HOST, 'port' => INTEGRATION_EVENTBUS_AMQP_PORT, 'user' => INTEGRATION_EVENTBUS_AMQP_USER, 'password' => INTEGRATION_EVENTBUS_AMQP_PASSWORD, 'vhost' => INTEGRATION_EVENTBUS_AMQP_VHOST, 'options' => [], 'consumer' => [ 'queue' => INTEGRATION_EVENTBUS_AMQP_CONSUMER_QUEUE, 'enable_heartbeat_sender' => false, 'prefetch_count' => 3 ], 'publisher' => [ 'project' => INTEGRATION_EVENTBUS_PROJECT_NAME, 'exchange' => INTEGRATION_EVENTBUS_AMQP_PUBLISHER_EXCHANGE, 'routing_key_prefix' => INTEGRATION_EVENTBUS_AMQP_PUBLISHER_ROUTING_KEY_PREFIX, ], ];