net_bazzline / php_component_cli_progres_bar
自由软件的免费 php 命令行进度条
1.0.0
2015-05-24 19:52 UTC
Requires
- php: >=5.3.3
This package is auto-updated.
Last update: 2024-09-16 20:49:51 UTC
README
本项目旨在提供一个易于使用的php组件,用于在shell环境中显示进度条。
当前变更日志可以在这里找到。
使用方法
//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();
示例
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
[========================================================================>] (3/3)
链接(其他优秀项目)
- 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/
结语
如果你喜欢它,请给它加星标 :-). 如果你需要它,请提交问题。如果你喜欢它,请拉取补丁。如果你在使用它,请写一篇博客 :-D。