PHP code example of pauci / cqrs-module
1. Go to this page and download the library: Download pauci/cqrs-module library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pauci / cqrs-module example snippets
return [
'cqrs' => [
'commandHandlerLocator' => [
'cqrs_default' => [
'handlers' => [
'UserService' => [
'ChangeUserName'
]
]
]
],
'eventHandlerLocator' => [
'cqrs_default' => [
'services' => [
'EchoEventListener' => [
'UserNameChanged'
]
]
]
]
]
];
// for example, in a controller:
$commandBus = $this->getServiceLocator()->get('cqrs.command_bus.cqrs_default');
$eventHandlerLocator = $this->getServiceLocator()->get('cqrs.event_handler_locator.cqrs_default');