Download the PHP package robotusers/cakephp-tactician without Composer
On this page you can find all versions of the php package robotusers/cakephp-tactician. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robotusers/cakephp-tactician
More information about robotusers/cakephp-tactician
Files in robotusers/cakephp-tactician
Package cakephp-tactician
Short Description CakePHP Tactician plugin
License MIT
Homepage https://github.com/robotusers/cakephp-tactician
Informations about the package cakephp-tactician
CakePHP Tactician
CakePHP plugin for league/tactician
.
NOTE: The plugin is under development.
Installation
Using the plugin
CakePHP integration
This plugin provides Controller and Model integration through Commander library.
Commander is a command bus abstraction library for PHP which enables you to decouple your code from a concrete command bus implementation.
Using the Commander (PHP 7.1+)
Install robotusers/commander
:
Set up your controllers:
For more information, read the docs.
Next you should configure the command bus which will be injected into your controllers and models that implement the CommandBusAwareInterface
.
Console (CakePHP 3.6+)
For console integration Tactician plugin provides a CommandFactory
that injects a command bus into compatible console shells and commands.
Set up your CommandRunner
as below:
Application hook (CakePHP 3.3+)
If your application supports middleware you can configure the command bus using an application hook.
You can use helper factory methods for building CommandBus
or CakePHP convention enabled CommandHandlerMiddleware
:
The command bus configured here will be injected into controllers and models in Model.initialize
and Controller.initialize
event listener.
Bootstrap
If you're still on pre 3.3 stack you can set up the listener in your bootstrap.php
file.
You can use build in quick start class:
QuickStart
can load simple CakePHP convention enabled bus if it hasn't been provided:
Conventions locator
CakePHP Conventions locator will look for command handlers based on a convention,
that commands should reside under App\Model\Command\
namespace and be suffixed with Command
string
and handlers should reside under App\Model\Handler\
namespace and be suffixed with Handler
string.
In this example App\Model\Command\MakeOrderCommand
command will map to App\Model\Handler\MakeOrderHandler
handler.
You can change default namespace and suffix using configuration options:
In this example App\Command\MakeOrder
command will map to App\Handler\MakeOrder
handler. Note a different namespace and no suffix.
Transaction middleware
Transaction middleware is a wrapper for CakePHP ConnectionInterface::transactional()
.
You need to provide a list of supported commands.
A list supports FQCN or convention supported name (eq Plugin.Name
).
This will wrap only Foo
and Bar
commands in a transaction:
You can include all commands by setting the $commands
argument to true
and exclude only some commands.
This will wrap all commands in a transaction with an exception for Foo
and Bar
commands:
All versions of cakephp-tactician with dependencies
league/tactician Version ^1.0
cakephp/core Version ~4.0
cakephp/datasource Version ~4.0