03/03
2015
dev-master
9999999-devFast and simple Symfony Console command creation
MIT
The Requires
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Fast and simple Symfony Console command creation

Fast and simple Symfony Console command creation, (*2)
#!/usr/bin/env php
<?php
require 'vendor/autoload.php';
use Gabrieljmj\Wwriteln\Wwriteln;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
$cl = new Writeln();
$cl->command('hello',
[
$cl->argument('name', InputArgument::REQUIRED, 'Your name')
],
[
$cl->option('uppercase', 'u', InputOption::VALUE_NONE)
],
function (InputInterface $input, OutputInterface $output) {
$txt = $input->getOption('uppercase') ? strtoupper('Hello ' . $input->getArgument('name'))
: 'Hello ' . $input->getArgument('name');
$output->writeln($txt);
});
$cl->run();
$ bin hello Gabriel Hello Gabriel $ bin hello Gabriel -u HELLO GABRIEL
Fast and simple Symfony Console command creation
MIT