elkuku/console-progressbar
Composer 安装命令:
composer require elkuku/console-progressbar
包简介
This class provides you with an easy-to-use interface to progress bars.
关键字:
README 文档
README
In general, to generate a progress bar you will call the constructor, then call the update() method in a loop.
You can use the reset() method to reuse one object to display another bar. Its parameters are the same as the constructor.
The Constructor expects 5 to 6 arguments:
- The first argument is the format string used to display the progress bar. It may (and should) contain placeholders that the class will replace with information like the progress bar itself, the progress in percent, and so on. Current placeholders are: %bar% The progress bar %current% The current value %max% The maximum malue (the "target" value) %fraction% The same as %current%/%max% %percent% The status in percent %elapsed% The elapsed time %estimate% An estimate for the remaining time More placeholders will follow. A format string like: "* stuff.tar %fraction% KB [%bar%] %percent%" will lead to a bar looking like this: "* stuff.tar 391/900 KB [=====>---------] 43.44%"
- The second argument is the string that is going to fill the progress bar. In the above example, the string "=>" was used. If the string you pass is too short (like "=>" in this example), the leftmost character is used to pad it to the needed size. If the string you pass is too long, excessive characters are stripped from the left.
- The third argument is the string that fills the "empty" space in the progress bar. In the above example, that would be "-". If the string you pass is too short (like "-" in this example), the rightmost character is used to pad it to the needed size. If the string you pass is too short, excessive characters are stripped from the right.
- The fourth argument specifies the width of the display. If the options are left untouched, it will tell how many characters the display should use in total. If the "absolute_width" option is set to false, it tells how many characters the actual bar (that replaces the %bar% placeholder) should use.
- The fifth argument is the target number of the progress bar. For example, if you wanted to display a progress bar for a download of a file that is 115 KB big, you would pass 115 here.
- The sixth argument optional. If passed, it should contain an array of options. For example, passing array('absolute_width' => false) would set the absolute_width option to false. Current options are:
option | def. | meaning
--------------------------------------------------------------------
percent_precision | 2 | Number of decimal places to show when
| | displaying the percentage.
fraction_precision | 0 | Number of decimal places to show when
| | displaying the current or target
| | number.
percent_pad | ' ' | Character to use when padding the
| | percentage to a fixed size. Senseful
| | values are ' ' and '0', but any are
| | possible.
fraction_pad | ' ' | Character to use when padding max and
| | current number to a fixed size.
| | Senseful values are ' ' and '0', but
| | any are possible.
width_absolute | true | If the width passed as an argument
| | should mean the total size (true) or
| | the width of the bar alone.
ansi_terminal | false | If this option is true, a better
| | (faster) method for erasing the bar is
| | used.
ansi_clear | false | If the bar should be cleared everytime
num_datapoints | 5 | How many datapoints to use to create
| | the estimated remaining time
The update() method expects just one parameter, the current status (somewhere between 0 and the target number passed to the constructor) and refreshes the display (or starts it, if it's the first call).
elkuku/console-progressbar 适用场景与选型建议
elkuku/console-progressbar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 408.87k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2013 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「console」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 elkuku/console-progressbar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elkuku/console-progressbar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 elkuku/console-progressbar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Additional artisan commands for Laravel
A table generator class for the PHP CLI.
Laravel console.
Test your Accelerated Mobile Pages right away from your terminal.
Eco CLI for Laravel .env syncing
统计信息
- 总下载量: 408.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-04-22