handmade-medium/console-progress-bar

v1.0.1 2017-05-02 16:12 UTC

This package is not auto-updated.

Last update: 2022-01-08 13:01:37 UTC


README

Provides a progress bar for console applications

  • ConsoleProgressBar = Generic PHP Cli Progress Bar
  • DrushProgressBar = Customized for use in a Drush console application

Usage

// width of the left title column
$colWidth = 50;
// size of bar
$size = ConsoleProgressBar::SIZE_MEDIUM;
// max value of loop
$max = 100;
// text for column
$text = "Test";
// init
$progressBar = new ConsoleProgressBar($max, $size, $text, $colWidth);
// loop
for($x=1;$x<=$max;$x++) {
$progressBar->showProgress($x);
}
// end
$progressBar->showComplete();

Examples

see examples/consoleExample.php

> php examples/consoleExample.php
Example Spinner      [X] 100%
Example Small Bar    [=========================] 100%
Example Medium Bar   [==================================================] 100%
Example Large Bar    [====================================================================================================] 100%
Custom Bar           [##################################################] 100%
Custom Spinner       [X] 100%

v1.0.2

  • Added Tests for Drush 6 .. 8
  • Added Test for Console
  • Added Custom bar and Custom Spinner options
  • Fixed Large Bar bug - do not exceed viewport width

v1.0

  • Initial Release