itantik / nette-cq-dispatcher
Nette extension for itantik/cq-dispatcher
Requires
- php: >= 7.2
- itantik/cq-dispatcher: ^0.5
- nette/di: ^v3.0
Requires (Dev)
- nette/bootstrap: ^3.0
- nette/tester: ^2.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.19
- phpstan/phpstan-nette: ^0.12.6
- squizlabs/php_codesniffer: 3.5.5
This package is auto-updated.
Last update: 2025-05-09 02:42:47 UTC
README
Nette extension for Command Query Dispatcher.
Installation
composer require itantik/nette-cq-dispatcher
It already includes itantik/cq-dispatcher. There is no need to install it separately.
Usage
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.
Change DI container
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
Change handler providers
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
Requirements
- PHP 7.2