Wallogit.com
2017 © Pedro PelΓ‘ez
Cli progress bar
Progress bar for cli apps, (*1)
Forked From dariuszp/cli-progress-bar, (*2)
, (*3)
composer require siteworx/cli-progress-bar
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(10, 5); $bar->display(); $bar->end();
Code above will show half full progress bar:, (*4)
ββββββββββββββββββββββββββββββββββββββββ 50.0% (5/10)
Windows can't handle some UTF characters so there is an alternate method to display progress bar:, (*5)
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(); $bar->displayAlternateProgressBar(); // this only switch style $bar->display(); $bar->end();
Output will be:, (*6)
XXXX____________________________________ 10.0% (10/100)
Add text to the progress bar using the following methods, (*7)
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(50, 0, "My Custom Text"); $bar->display(); $bar->end();
or, (*8)
use Siteworx\ProgressBar\CliProgressBar;
$bar = new CliProgressBar();
$bar->setDetails("My Custom Text");
$bar->display();
$bar->end();
Estimated time to completion is available. At least 2 iterations are required to calculate an ET.
The more iterations the better the estimate calculation will be., (*9)
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(); $bar->displayTimeRemaining()->display(); $bar->end();
will output, (*10)
ββββββββββββββββββββββββββββββββββββββββ 50.0% (5/10) 02:14
Also update asynchronously with setDetails(), (*11)
More features like: - changing progress bar length (basicWithShortBar.php) - changing bar color (colors.php) - animation example (basic.php) - etc..., (*12)
in example directory., (*13)
Author: PΓ³Εtorak Dariusz Contributors: @mathmatrix828 - Mason Phillips, (*14)
License: MIT, (*15)