All Projects → redantnl → console

redantnl / console

Licence: MIT license
Menu helper for Symfony Console component

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to console

terminable-loop-command
A Shell+PHP wrapper to run Symfony console commands in loop under a daemon or Kubernetes
Stars: ✭ 16 (-15.79%)
Mutual labels:  symfony-console
pecan
ReactPHP Shell, based on the Symfony Console component.
Stars: ✭ 43 (+126.32%)
Mutual labels:  symfony-console
php-backtrace
Show nice equivalent to debug_backtrace(), with caller, code preview etc.
Stars: ✭ 18 (-5.26%)
Mutual labels:  symfony-console
framework
Cygnite PHP Framework- A Modern Toolkit For Web Developers
Stars: ✭ 43 (+126.32%)
Mutual labels:  symfony-console

RedAnt Console

Menu select helper for Symfony Console

This menu helper is a bridge for PHPSchool's CliMenu library, so that it can easily be used inside the Symfony Console.

It provides an interactive menu that you can navigate using the arrow and enter keys.

Only compatible with UNIX tty-style terminals.

Installation

Install through composer require redant/console.

Setup

Register the helper in your HelperSet:

use RedAnt\Console\Helper\SelectHelper;

// Further on in your code ...
$this->getHelperSet()->set(new SelectHelper(), 'select');

Then you can start using the helper like this:

$helper = $this->getHelper('select');
$value = $helper->select(
    $input,
    'What is your favorite food?',
    [
        'hamburger' => 'Hamburger',
        'pizza'     => 'Pizza',
        'sushi'     => 'Sushi',
        'poke'      => 'Poké bowl'
    ]
);

// $value = 'poke' when the fourth option was chosen
// $value = null when the user canceled

About

Lovingly crafted by RedAnt in Utrecht, NL.

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].