1. Go to this page and download the library: Download asika/php-code-generator 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/ */
php
namespace FlowerTemplate\Task;
use FlowerTemplate\Action;
use CodeGenerator\Controller\AbstractTaskController;
class Generate extends AbstractTaskController
{
public function execute()
{
$this->doAction(new Action\CopyAllAction);
}
}
php
namespace FlowerTemplate\Action;
use CodeGenerator\Action\AbstractAction;
use CodeGenerator\FileOperator\CopyOperator;
class CopyAllAction extends AbstractAction
{
protected function doExecute()
{
$copyOperator = new CopyOperator($this->io, (array) $this->config['tag.variable']);
$copyOperator->copy($this->config['path.src'], $this->config['path.dest'], $this->config['replace']);
}
}
php
class Generate extends AbstractTaskController
{
public function execute()
{
$this->doAction(new Action\CopyAllAction);
$this->doAction(new Action\ImportSqlAction);
$this->doAction(new Action\Github\CloneSomeRepoAction);
$this->doAction(new Action\User\CreateNewUserAction);
}
}
php
$copyOperator = new CopyOperator($this->io, array('{@', '@}'));
$copyOperator->copy($src, $dest, $replaceArray);
php
protected function registerCommands()
{
$this->addCommand(new Command\Generate\Generate);
$this->addCommand(new Command\Init\Init);
$this->addCommand(new Command\Convert\Convert);
// Add here
$this->addCommand(new Command\MyTask\Task);
}
php
namespace FlowerTemplate\Task;
use FlowerTemplate\Action;
use CodeGenerator\Controller\TaskController;
class MyTask extends TaskController
{
public function execute()
{
$this->doAction(new Action\CopyAllAction);
}
}
bash
php bin/generator mytask <arguments>
php
$controller = new GeneratorController(new MyIOAdapter($input, $output));
$controller->setTask($input->getArgument('task'))->execute();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.