PHP code example of tomsihap / console-select
1. Go to this page and download the library: Download tomsihap/console-select library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tomsihap / console-select example snippets
// app.php
'providers' => [
EddIriarte\Console\Providers\SelectServiceProvider::class,
],
# importing : \EddIriarte\Console\Helpers\SelectionHelper
# pasing the input and output interfaces
$this->getHelperSet()->set(
new SelectionHelper($this->input, $this->output)
);
$selected = $this->select(
'Select characters that appeared in "Star Wars, Episode I - The phantom menace"',
[
'Ahsoka Tano',
'Anakin Skywalker',
'Boba Fett',
'Chewbacca',
'Count Dooku',
'Darth Maul',
'Darth Vader',
'Finn',
'Han Solo',
'Jabba the Hutt',
'Jar Jar Binks',
'Kylo Ren',
'Lando Calrissian',
'Luke Skywalker',
'Mace Windu',
'Obi-Wan Kenobi',
'Padmé Amidala',
'Sheev Palpatine',
'Poe Dameron',
'Princess Leia Organa',
'Qui-Gon Jinn',
'Rey',
'Watto',
'Yoda',
]
);
$selected = $this->select(
'What is the name of the ancient Jedi master that lives at the swamps of Dagobah',
[
'Ahsoka Tano',
'Anakin Skywalker',
'Boba Fett',
'Chewbacca',
'Count Dooku',
'Darth Maul',
'Darth Vader',
'Finn',
'Han Solo',
'Jabba the Hutt',
'Jar Jar Binks',
'Kylo Ren',
'Lando Calrissian',
'Luke Skywalker',
'Mace Windu',
'Obi-Wan Kenobi',
'Padmé Amidala',
'Sheev Palpatine',
'Poe Dameron',
'Princess Leia Organa',
'Qui-Gon Jinn',
'Rey',
'Watto',
'Yoda',
],
false // third argument(bool) that allows multiple selections (default: true)
);