https://github.com/redantnl/console
Menu helper for Symfony Console component
https://github.com/redantnl/console
symfony symfony-console
Last synced: about 1 year ago
JSON representation
Menu helper for Symfony Console component
- Host: GitHub
- URL: https://github.com/redantnl/console
- Owner: redantnl
- License: mit
- Created: 2017-03-30T20:11:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-25T08:47:41.000Z (over 2 years ago)
- Last Synced: 2025-02-28T00:14:34.327Z (about 1 year ago)
- Topics: symfony, symfony-console
- Language: PHP
- Size: 20.5 KB
- Stars: 21
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
RedAnt Console
==============
Menu select helper for Symfony Console
-------------------------------
This menu helper is a bridge for PHPSchool's
[CliMenu](https://github.com/php-school/cli-menu) 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:
```php
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:
```php
$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.