gabrieljmj / writeln
This package is abandoned and no longer maintained.
No replacement package was suggested.
Fast and simple Symfony Console command creation
dev-master
2015-03-03 18:59 UTC
Requires
- symfony/console: 3.0.*@dev
Requires (Dev)
- phpunit/phpunit: 4.7.*@dev
This package is auto-updated.
Last update: 2019-02-20 19:40:51 UTC
README
Fast and simple Symfony Console command creation
Usage example
#!/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