1. Go to this page and download the library: Download pavelmics/yii-tactician library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pavelmics / yii-tactician example snippets
class TestCommand
{
public $someParam;
public $someOtherParam;
public function __construct($someParam, $someOtherParam = 'defaultValue')
{
$this->someParam = $someParam;
$this->someOtherParam = $someOtherParam;
}
}
class TestCommandHandler
{
public function handle(TestCommand $command)
{
// do command stuff hire!
// we can use $command->someParam and $this->someOtherParam
}
}
...
public function actionCreateSomething()
{
$someParam = Yii::app()->request->getPost('some_param');
$command = new TestCommand($someParam);
$result = Yii::app()->commandBus->handle($command);
if ($result) {
$this->redirect(
Yii::app()->createUrl('something/show', ['id' => $result->id])
);
} else {
$this->render('errorSomething');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.