Nette extension for Command Query Dispatcher.
composer require itantik/nette-cq-dispatcher
It already includes itantik/cq-dispatcher. There is no need to install it separately.
Register the extension in Nette configuration file.
extensions:
cqdispatcher: Itantik\CQDispatcher\Bridges\Nette\CQDispatcherExtension
No additional settings are required. By default, CQ Dispatcher uses Nette DI Container. With additional configurations you can change default settings.
Create an adapter to your DI container and register it in the configuration file. The adapter implements Itantik\CQDispatcher\DI\IContainer
interface.
cqdispatcher:
# default DI container
container: Itantik\CQDispatcher\Adapters\NetteDIContainer
Default command and query handler providers use a DI container to create a handler instance. You can create your own providers that meet your needs, even without a DI container.
Providers have to implement Itantik\CQDispatcher\Command\ICommandHandlerProvider
respectively Itantik\CQDispatcher\Query\IQueryHandlerProvider
interface.
cqdispatcher:
# default providers
commandHandlerProvider: Itantik\CQDispatcher\Command\DiCommandHandlerProvider
queryHandlerProvider: Itantik\CQDispatcher\Query\DiQueryHandlerProvider
- PHP 7.2