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.
Via Composer
$ composer require nigelgreenway/demander-container-plugin
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
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email github+demander.security@futurepixels.co.uk instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.