1. Go to this page and download the library: Download programster/cli-menu 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/ */
programster / cli-menu example snippets
$overComplicatedPrintHelloWorldObject = new class {
public function __invoke() {
print PHP_EOL . "Hello world!" . PHP_EOL;
}
};
$exitCallback = function() { die("Goodbye then!" . PHP_EOL); };
$sayHelloWorldOption = new \Programster\CliMenu\MenuOption("Print hello world", $overComplicatedPrintHelloWorldObject);
$exitOption = new \Programster\CliMenu\MenuOption("Exit", $exitCallback);
$cliMenu = new Programster\CliMenu\ActionMenu("My Action Menu", $sayHelloWorldOption, $exitOption);
while(true)
{
$cliMenu->run();
}
$possibleValues = array(
new Programster\CliMenu\ValueOption("Seconds in a day", (60 * 60 * 24)),
new Programster\CliMenu\ValueOption("Seconds in a week", (60 * 60 * 24 * 52)),
new Programster\CliMenu\ValueOption("Seconds in a year", (60 * 60 * 24 * 365)),
);
$valueMenu = new Programster\CliMenu\ValueMenu("Pick your seconds amount", ...$possibleValues);
$chosenValue = $valueMenu->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.