nigelgreenway / demander-container-plugin
A mediator for nigelgreenway/demander using league/container
Installs: 845
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:lib
Requires
- php: >= 5.5
- nigelgreenway/demander: ^1.0
Requires (Dev)
- league/container: ^1
- phpunit/phpunit: ^4
- squizlabs/php_codesniffer: ^2.5
This package is auto-updated.
Last update: 2024-11-27 15:58:18 UTC
README
This is a plugin for NigelGreenway/Demander, a Command/Query mediator.
This implements the Mediator interfaces and allows League/Container to load a Query or Command handler.
Install
Via Composer
$ composer require nigelgreenway/demander-container-plugin
Usage
Below is a very basic example on how to use the package. More docs will be released as I get time.
$container = new Container(null, null, null); $container->add( RegisteredQueryHandler::class, RegisteredQueryHandler::class )->withArgument('query.test'); $container->add( RegisteredCommandHandler::class, RegisteredCommandHandler::class )->withArgument('command.test'); $mediator = new ContainerMediator( $container, [ RegisteredQuery::class => RegisteredQueryHandler::class, ], [ RegisteredCommand::class => RegisteredCommandHandler::class, ] ); $viewModel = $mediator->request(new RegisteredQuery()); echo $viewModel->test; // test.query $command = $mediator->execute(new RegisteredCommand()); echo $command; // test.command
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email github+demander.security@futurepixels.co.uk instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.