2017 © Pedro Peláez
 

library writeln

Fast and simple Symfony Console command creation

image

gabrieljmj/writeln

Fast and simple Symfony Console command creation

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status License Latest Unstable Version Total Downloads Scrutinizer Code Quality, (*1)

Fast and simple Symfony Console command creation, (*2)

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

The Versions

03/03 2015

dev-master

9999999-dev

Fast and simple Symfony Console command creation

  Sources   Download

MIT

The Requires

 

The Development Requires