mrdatawolf / multiline-progressbar
Creates a group of commandline progressbars to interact with.
Installs: 6 497
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^6.3
This package is not auto-updated.
Last update: 2025-08-03 10:08:18 UTC
README
Display multiple progressbars and update them at the same time.
Use case:
Display one or more progressbars in the console at the same time
Composer Install
Add the following to your composer.json
{
"require": {
"mrdatawolf/multiline-progressbar": "dev-master"
}
}
5.1 Notes
This has only been tested on Laravel 5.1 but probably works with other versions
It allows up to 3 rows of progressbars and a messagebar to be run as a group.
Example
$totalBars = 3;
$xMax = 3;
$yMax = ($totalBars > 1) ? 4 : 0;
$zMax = ($totalBars > 2) ? 10 : 0;
$totalYs=0;
$totalZs=0;
$this->progressBar = new MultilineProgressbar($this->output, 'Processing Events', '|', $xMax, $yMax, $zMax);
if($this->option('debug')) {
$this->progressBar->debug();
}
$this->progressBar->start();
$this->progressBar->setMessage('Working thru ' . $xMax . ' primary blocks and '. $yMax . ' secondary blocks with ' . $zMax . ' atomic items','message');
for($x=1; $x<=$xMax;$x++) {
$this->progressBar->setMessage('Working in main block '. ($x), 'progress');
$this->progressBar->advance(['message','progress']);
if($totalBars > 1) {
for ($y = 1; $y <= $yMax; $y++) {
$totalYs++;
$this->progressBar->setMessage('Working in secondary group '.$totalYs,'progress2');
$this->progressBar->advance(['progress2']);
if($totalBars > 2) {
for ($z = 1; $z <= $zMax; $z++) {
$mainMessageAddendum = ($z % 7 == 0) ? 'foo' : 'bar';
$this->progressBar->setMessage('Working thru ' . $xMax . ' primary blocks and '. $yMax . ' secondary blocks with ' . $zMax . ' atomic items - '. $mainMessageAddendum);
$totalZs++;
usleep(100000);
$this->progressBar->setMessageAndSpinAndAdvance('Working with atomic unit '.$totalZs, 'progress3');
}
}
usleep(100000);
}
}
usleep(100000);
}
$this->progressBar->finish();
The above will create 3 progressbars and a "message" bar above the progressbars. It will also put a "spinner" to the right of the message in the message bar.
Sample Output
Working thru 3 primary blocks and 4 secondary blocks with 10 atomic items -> | : 14 secs/14 secs 24.0 MiB
Working in main block 3 : 3/3 [============================] 100%
Working in secondary group 12 : 12/12 [============================] 100%
Working with atomic unit 120 : 120/120 [============================] 100%
Special Thanks
This project was made possible by Let's Go Learn