PHP code example of irfantoor / console

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

    

irfantoor / console example snippets




rfanTOOR\Console;

$c = new Console;

# printing with style
$c->write("Hello ", "green");
$c->writeln("World ", "red");

# when a string of texts is given, a banner is printed
$c->writeln(['Its a banner'], ['bg_blue','white']);

# reading from console
$response = $c->read("Are you ok? [Y/N]", "info");

$c->write("you responded with: ");
$c->writeln($response, ["info", "reverse"]);


 
$c = new IrfanTOOR\Console([
    'info' => ['bg_black', 'yellow'],
    'url'  => ['red', 'underline'],
]);

# Theme
$c->writeln("Modified theme >> info", "info");
$c->writeln("https://github.com/irfantoor/console", "url");

$c->setTheme([
    'url' => ['red', 'bg_yellow', 'underline']
]);

$c->writeln("https://github.com/irfantoor/console", "url");