prooph / service-bus
PHP Enterprise Service Bus Implementation supporting CQRS and DDD
Installs: 1 271 104
Dependents: 38
Suggesters: 2
Security: 0
Stars: 441
Watchers: 30
Forks: 56
Open Issues: 1
Requires
- php: ^7.3 | ^8.0
- prooph/common: ^4.0.0
Requires (Dev)
- phpspec/prophecy: ^1.9
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.3
- prooph/bookdown-template: ^0.2.3
- prooph/php-cs-fixer-config: ^0.4
- psr/container: ^1.0
- react/promise: ^2.4.1
- sandrokeil/interop-config: ^2.0.1
- satooshi/php-coveralls: ^1.0
Suggests
- prooph/event-store-bus-bridge: Let the EventBus dispatch persisted DomainEvents
- prooph/service-bus-zfc-rbac-bridge: Use ZfcRbac as authorization service for route and finalize guard
- psr/container: ^1.0 for usage of provided factories
- react/promise: ^2.4.1 for usage with provided QueryBus
- sandrokeil/interop-config: For usage of provided factories
- zendframework/zend-servicemanager: Use Zend ServiceManager to lazy load your handlers and listeners
Conflicts
- sandrokeil/interop-config: <2.0.1
- dev-master
- v6.3.0
- v6.2.2
- v6.2.1
- v6.2.0
- v6.1.1
- v6.1.0
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v6.0.0-beta3
- v6.0.0-beta2
- v6.0.0-beta1
- 5.x-dev
- v5.2.1
- v5.2.0
- v5.1.0
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0
- v4.6
- v4.5
- v4.4.1
- v4.4
- v4.3
- v4.2
- v4.2-beta.1
- v4.1.2
- v4.1.1
- v4.1
- v4.0
- v3.2
- v3.1
- v3.0.1
- v3.0
- v2.0
- v1.3.1
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v0.4.0
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.1
- 0.1.0
This package is auto-updated.
Last update: 2024-10-25 23:49:50 UTC
README
PHP 7.1+ lightweight message bus supporting CQRS and Micro Services
Important
This library will receive support until December 31, 2019 and will then be deprecated.
For further information see the official announcement here: https://www.sasaprolic.com/2018/08/the-future-of-prooph-components.html
Messaging API
prooph/service-bus is a lightweight messaging facade. It allows you to define the API of your model with the help of messages.
- Command messages describe actions your model can handle.
- Event messages describe things that happened while your model handled a command.
- Query messages describe available information that can be fetched from your (read) model.
prooph/service-bus shields your model. Data input and output ports become irrelevant and no longer influence business logic. We're looking at you Hexagonal Architecture.
prooph/service-bus decouples your model from any framework. You can use a web framework like Zend, Symfony, Laravel and co. to handle http requests and pass them via prooph/service-bus to your model but you can also receive the same messages via CLI or from a messaging system like RabbitMQ or Beanstalkd.
It is also a perfect fit for microservices architecture as it provides an abstraction layer for message-based inter-service communication.
Installation
You can install prooph/service-bus via composer by running composer require prooph/service-bus
, which will install the latest version as requirement to your composer.json.
Quick Start
<?php use Prooph\ServiceBus\CommandBus; use Prooph\ServiceBus\Example\Command\EchoText; use Prooph\ServiceBus\Plugin\Router\CommandRouter; $commandBus = new CommandBus(); $router = new CommandRouter(); //Register a callback as CommandHandler for the EchoText command $router->route('Prooph\ServiceBus\Example\Command\EchoText') ->to(function (EchoText $aCommand): void { echo $aCommand->getText(); }); //Expand command bus with the router plugin $router->attachToMessageBus($commandBus); //We create a new Command $echoText = new EchoText('It works'); //... and dispatch it $commandBus->dispatch($echoText); //Output should be: It works
Live Coding Introduction
Documentation
Documentation is in the docs tree, and can be compiled using bookdown.
$ php ./vendor/bin/bookdown docs/bookdown.json $ php -S 0.0.0.0:8080 -t docs/html/
Then browse to http://localhost:8080/
Support
- Ask questions on Stack Overflow tagged with #prooph.
- File issues at https://github.com/prooph/service-bus/issues.
- Say hello in the prooph gitter chat.
Contribute
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.
License
Released under the New BSD License.