Ejemplo n.º 1
0
    }
    \PHPCli\Cli::new_line();
}
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Text Error Output");
\PHPCli\Cli::error("Failure: This is a plain error message");
\PHPCli\Cli::error("Failure: This is a error message with a yellow foreground colour", \PHPCli\Color::$yellow);
\PHPCli\Cli::error("Failure: This is a string with a white foreground and Red Background", \PHPCli\Color::$white, \PHPCli\BackgroundColor::$red);
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Prompt for input");
//Prompt for input
$colour = \PHPCli\Cli::prompt("What is your favorite colour?");
\PHPCli\Cli::write("I also like " . $colour);
// Takes any input, but offers default
$colour = \PHPCli\Cli::prompt('What is your favorite color?', 'white');
\PHPCli\Cli::write("I also like " . $colour);
// Will only accept the options in the array
$ready = \PHPCli\Cli::prompt('Are you ready to continue?', array('y', 'n'));
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Progress Bar");
//Simple Example
$size = 10;
\PHPCli\ProgressBar::start($size);
for ($i = 1; $i <= $size; $i++) {
    \PHPCli\ProgressBar::next();
    \PHPCli\Cli::wait(1);
}
\PHPCli\ProgressBar::finish();
//Update message
$size = 10;
\PHPCli\ProgressBar::start($size, "Starting in about 5 seconds");
Ejemplo n.º 2
0
<?php

require __DIR__ . '/../vendor/autoload.php';
\PHPCli\Cli::write("\n Tables: ");
\PHPCli\Cli::write("----------------------------------------\n");
$table = new \PHPCli\Table();
$data = (include 'data.php');
$table->setTableColor(\PHPCli\Color::$blue);
$table->setHeaderColor(\PHPCli\Color::$light_blue);
$table->addField('First Name', 'firstName', false);
$table->addField('Last Name', 'lastName', false);
$table->addField('DOB', 'dobTime', new \PHPCli\Cell\DateCell('Y M D'));
$table->addField('Admin', 'isAdmin', new \PHPCli\Cell\YesNoCell(), \PHPCli\Color::$yellow);
$table->addField('Last Seen', 'lastSeenTime', new \PHPCli\Cell\CountDownCell(), \PHPCli\Color::$red);
$table->addField('Expires', 'expires', new \PHPCli\Cell\DateCell(), \PHPCli\Color::$green);
$table->addField('Active', 'active', new \PHPCli\Cell\BoolCell(), \PHPCli\Color::$purple);
$table->injectData($data);
$table->display();
// Play sound to let the user know the example has finished.
//\PHPCli\Cli::beep(1);