Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2020-12-01 (15 days ago) | | Not yet rated by the users | | Total: 55 This week: 7 | | All time: 9,866 This week: 30 |
|
Description | | Author |
This class can show a progress bar in a console terminal.
It can display a progress bar in a way that it shows the number of steps that were performed for a task divided in given number of smaller tasks.
The class can advance to the next step until all the steps are done and it updates the ways the progress bar appears to reflect the proportion of steps that were done compared to the total number steps. | |
|
|
Innovation award
Nominee: 8x |
|
Details
Progress Bar for PHP CLI Scripts / Shell Environment
This project aims to deliver a easy to use php component for displaying a progress bar in the shell environment.
The current change log can be found here.
Usage
//assuming $items contains an array of items
$progressBar = new \Net\Bazzline\Component\Cli\ProgressBar\ProgressBar();
$progressBar->setTotalSteps(count($items));
foreach ($items as $item) {
//do something with the item
$progressBar->forward();
}
//to be on the save side, tell the progress bar that the show is over ;-)
$progressBar->isFinished();
Example
cd <project root>
./example/run.php
+-----------------------------+
| Example of the progress bar |
+-----------------------------+
This demo will demonstrate 5 progress bars.
The number of items will be 3, 6, 9, 12, 150.
The current update interval is 1 second.
Press CTRL-C to stop this demonstration
========================================================================>
Links (other good projects)
-
https://github.com/levi-putna/phpcli
-
https://github.com/guiguiboy/PHP-CLI-Progress-Bar
-
https://nixshell.wordpress.com/2009/09/08/get-the-width-of-the-terminal/
Final Words
Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if you use it :-D.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.