Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gabrieljmj/writeln

Fast and simple Symfony Console command creation
https://github.com/gabrieljmj/writeln

Last synced: about 2 months ago
JSON representation

Fast and simple Symfony Console command creation

Awesome Lists containing this project

README

        

![](http://i.imgur.com/JDZP2vC.gif)
=======
[![Build Status](https://travis-ci.org/GabrielJMJ/Writeln.svg)](https://travis-ci.org/GabrielJMJ/Writeln) [![License](https://img.shields.io/packagist/l/gabrieljmj/writeln.svg)](https://packagist.org/packages/gabrieljmj/writeln) [![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--master-orange.svg)](https://packagist.org/packages/gabrieljmj/writeln) [![Total Downloads](https://img.shields.io/packagist/dt/gabrieljmj/wirteln.svg)](https://packagist.org/packages/gabrieljmj/writeln) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/gabrieljmj/writeln.svg)](https://scrutinizer-ci.com/g/GabrielJMJ/Writeln/?branch=dev)

Fast and simple Symfony Console command creation

## Usage example
```php
#!/usr/bin/env php
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();
```
```console
$ bin hello Gabriel
Hello Gabriel

$ bin hello Gabriel -u
HELLO GABRIEL
```