Advertisement
mhyusuf

Untitled

Nov 13th, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2. namespace Console\App\Commands;
  3.  
  4. use Symfony\Component\Console\Command\Command;
  5. use Symfony\Component\Console\Input\InputInterface;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. use Symfony\Component\Console\Input\InputArgument;
  8.  
  9. class HelloworldCommand extends Command
  10. {
  11.     protected function configure()
  12.     {
  13.         $this->setName('hello-world')
  14.             ->setDescription('Prints Hello-World!')
  15.             ->setHelp('Demonstration of custom commands created by Symfony Console component.')
  16.             ->addArgument('username', InputArgument::REQUIRED, 'Pass the username.');
  17.     }
  18.  
  19.     protected function execute(InputInterface $input, OutputInterface $output)
  20.     {
  21.         $output->writeln(sprintf('Hello World!, %s', $input->getArgument('username')));
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement