2017 © Pedro PelΓ‘ez
 

library cli-progress-bar

Cli progress bar

image

siteworxpro/cli-progress-bar

Cli progress bar

  • Wednesday, April 4, 2018
  • by alphafloor
  • Repository
  • 0 Watchers
  • 2 Stars
  • 8,022 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 71 % Grown

The README.md

cli-progress-bar Build Status

Progress bar for cli apps, (*1)

Forked From dariuszp/cli-progress-bar, (*2)

example animation, (*3)

Installation

composer require siteworx/cli-progress-bar

Usage

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)

The Versions

04/04 2018

dev-master

9999999-dev

Cli progress bar

  Sources   Download

MIT

by Siteworxpro

04/04 2018

1.1.2

1.1.2.0

Cli progress bar

  Sources   Download

MIT

by Siteworxpro

15/03 2018

1.1.1

1.1.1.0

Cli progress bar

  Sources   Download

MIT

by Siteworxpro

11/03 2018

1.1.0

1.1.0.0

Cli progress bar

  Sources   Download

MIT

by Siteworxpro

15/02 2018

1.0.0

1.0.0.0

Cli progress bar

  Sources   Download

MIT

by Siteworxpro