Created
January 31, 2020 04:01
-
-
Save remoharsono/336f4eb4b0570fd2f40f75ef383e4ebb to your computer and use it in GitHub Desktop.
Artis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/../vendor/autoload.php'; | |
use Symfony\Component\Console\Application; | |
use Artis\App\Commands\CreateProject; | |
use Artis\App\Commands\CreateController; | |
use Artis\App\Commands\CreateModel; | |
use Artis\App\Commands\CreateView; | |
$app = new Application(); | |
$app->add(new CreateProject()); | |
$app->add(new CreateModel()); | |
$app->add(new CreateView()); | |
$app->add(new CreateController()); | |
$app->run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"symfony/console": "^4.4" | |
}, | |
"autoload": { | |
"psr-4": { | |
"Artis\\": "src" | |
}, | |
"classmap": ["src"] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Artis\App\Commands; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
class CreateController extends Command { | |
protected function configure() { | |
$this->setName('createController')->setDescription('Display hello world')->setHelp('Just show hello world')->addArgument('controllerName', InputArgument::REQUIRED, 'Pass the username'); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$output->writeln(sprintf('Controller "%s" created successfully', $input->getArgument('controllerName'))); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Artis\App\Commands; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
class CreateModel extends Command { | |
protected function configure() { | |
$this->setName('createModel')->setDescription('Create model')->setHelp('Just create model')->addArgument('modelName', InputArgument::REQUIRED, 'Pass the model name'); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$output->writeln(sprintf('Model "%s" created successfully', $input->getArgument('modelName'))); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Artis\App\Commands; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
class CreateProject extends Command { | |
protected function configure() { | |
$this->setName('createProject')->setDescription('Create project')->setHelp('Just create project')->addArgument('projectName', InputArgument::REQUIRED, 'Pass the project name'); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$output->writeln(sprintf('Project "%s" created successfully', $input->getArgument('projectName'))); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Artis\App\Commands; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
class CreateRoute extends Command { | |
protected function configure() { | |
$this->setName('createRoute')->setDescription('Create new route')->setHelp('Just create new route')->addArgument('routeName', InputArgument::REQUIRED, 'Pass the route name'); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$output->writeln(sprintf('Route "%s" created successfully', $input->getArgument('routeName'))); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Artis\App\Commands; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
class CreateView extends Command { | |
protected function configure() { | |
$this->setName('createView')->setDescription('Create view')->setHelp('Just create view')->addArgument('viewName', InputArgument::REQUIRED, 'Pass the view name'); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$output->writeln(sprintf('View "%s" created successfully', $input->getArgument('viewName'))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment