PHP code example of nvan / cli-plus

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

    

nvan / cli-plus example snippets


use nvan\CliPlus\Console;
Console::writeLine('Hello world!');
Console::write('This is on the next line!');
Console::write('But this is not!');

use nvan\CliPlus\Colors;
Console::setForegroundColor(Colors::White);
Console::setBackgroundColor(Colors::Red);
Console::write('This text is white with red background!');

use nvan\CliPlus\Formats;
Console::setFormat(Formats::Bold);
Console::write('This text is bold!');

Console::write('Enter your password: ');
Console::addFormat(Formats::Hidden);
Console::write();
$pass = readline();
Console::removeFormat(Formats::Hidden);

if($pass === '12345') {
    Console::setForegroundColor(Colors::LightGreen);
    Console::writeLine('Password is correct! Welcome!');
}