PHP code example of lfischer / cli-helper

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

    

lfischer / cli-helper example snippets


use lfischer\cli\ForegroundColor;
use lfischer\cli\Color\FG;

echo ForegroundColor::BLUE . 'Blue foreground!' . ForegroundColor::RESET . PHP_EOL;
echo ForegroundColor::blue('Blue foreground!') . PHP_EOL;
echo FG::BLUE . 'Blue foreground!' . FG::NONE . PHP_EOL;
echo FG::blue('Blue foreground!') . PHP_EOL;
echo FG::rgb(0, 0, 255) . 'Blue foreground!' . FG::RESET . PHP_EOL;

use lfischer\cli\BackgroundColor;
use lfischer\cli\Color\BG;

echo BackgroundColor::BLUE . 'Blue foreground!' . BackgroundColor::RESET . PHP_EOL;
echo BackgroundColor::blue('Blue foreground!') . PHP_EOL;
echo BG::BLUE . 'Blue foreground!' . BG::NONE . PHP_EOL;
echo BG::blue('Blue foreground!') . PHP_EOL;
echo BG::rgb(0, 0, 255) . 'Blue foreground!' . BG::RESET . PHP_EOL;

use lfischer\cli\Style;

echo Style::bold('Bold') . PHP_EOL;
echo Style::underline('Underline') . PHP_EOL;
echo Style::nounderline('No underline') . PHP_EOL;
echo Style::negative('Negative') . PHP_EOL;
echo Style::positive('Positive') . PHP_EOL;

use lfischer\cli\Input;

$name = Input::ask('What is your name?');
$result = Input::ask('Do you like PHP?', 'yes');