pauci / cqrs-module
Zend Framework 2 Module that provides functionality for CQRS library
Installs: 1 684
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 3
Open Issues: 0
pkg:composer/pauci/cqrs-module
Requires
- php: ^5.6 || ^7.0
- pauci/cqrs: ^0.2.5
- zendframework/zend-mvc: ^2.7.10 || ^3.0.4
- zendframework/zend-servicemanager: ^2.7.8 || ^3.2.0
- zendframework/zend-stdlib: ^2.7.7 || ^3.1.0
Requires (Dev)
README
CQRSModule integrates CQRS library with Zend Framework 2 quickly and easily.
Installation
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
Install the module via command:
php composer.phar require pauci/cqrs-module
# (When asked for a version, type `dev-master`)
Then add CQRSModule to your config/application.config.php
Setup
return [ 'cqrs' => [ 'commandHandlerLocator' => [ 'cqrs_default' => [ 'handlers' => [ 'UserService' => [ 'ChangeUserName' ] ] ] ], 'eventHandlerLocator' => [ 'cqrs_default' => [ 'services' => [ 'EchoEventListener' => [ 'UserNameChanged' ] ] ] ] ] ];
Registered Service names
cqrs.command_bus.cqrs_default: aCQRS\CommandHandling\CommandBusInterfaceinstancecqrs.command_handler_locator.cqrs_default: aCQRS\CommandHandling\Locator\CommandHandlerLocatorInterfaceinstancecqrs.transaction_manager.cqrs_default: aCQRS\CommandHandling\TransactionManager\TransactionManagerInterfaceinstancecqrs.event_publisher.cqrs_default: theCQRS\EventHandling\Publisher\EventPublisherInterfaceinstancecqrs.event_bus.cqrs_default: theCQRS\EventHandling\EventBusInterfaceinstancecqrs.event_handler_locator.cqrs_default: theCQRS\EventHandling\Locator\EventHandlerLocatorInterfaceinstancecqrs.event_store.cqrs_default: theCQRS\EventStore\EventStoreInterfaceinstancecqrs.serializer.reflection: theCQRS\Serializer\ReflectionSerializerinstance
Service Locator
To access the entity manager, use the main service locator:
// for example, in a controller: $commandBus = $this->getServiceLocator()->get('cqrs.command_bus.cqrs_default'); $eventHandlerLocator = $this->getServiceLocator()->get('cqrs.event_handler_locator.cqrs_default');