PHP code example of redant / console

1. Go to this page and download the library: Download redant/console 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/ */

    

redant / console example snippets


use RedAnt\Console\Helper\SelectHelper;

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

$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