PHP code example of mrdatawolf / multiline-progressbar
1. Go to this page and download the library: Download mrdatawolf/multiline-progressbar library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mrdatawolf / multiline-progressbar example snippets
$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();