예제 #1
0
파일: index.php 프로젝트: levi-putna/phpcli
//Unknown size
\PHPCli\ProgressBar::start(0, "One moment please");
usleep(10000000);
$size = 200;
// Fixed here, this would be the result of some slow logic/query/api-call
\PHPCli\ProgressBar::setTotal(200);
for ($i = 1; $i <= $size; $i++) {
    \PHPCli\ProgressBar::next();
    usleep(100000);
}
\PHPCli\ProgressBar::finish();
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Tables");
$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();
//Draw a line to close
\PHPCli\Cli::line();
// Play sound to let the user know the example has finished.
\PHPCli\Cli::beep(1);
예제 #2
0
파일: table.php 프로젝트: levi-putna/phpcli
<?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);