siteworxpro/cli-progress-bar
Composer 安装命令:
composer require siteworxpro/cli-progress-bar
包简介
Cli progress bar
README 文档
README
Progress bar for cli apps
Forked From dariuszp/cli-progress-bar
Installation
composer require siteworx/cli-progress-bar
Usage
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(10, 5); $bar->display(); $bar->end();
Code above will show half full progress bar:
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░ 50.0% (5/10)
Windows can't handle some UTF characters so there is an alternate method to display progress bar:
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(); $bar->displayAlternateProgressBar(); // this only switch style $bar->display(); $bar->end();
Output will be:
XXXX____________________________________ 10.0% (10/100)
Add text to the progress bar using the following methods
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(50, 0, "My Custom Text"); $bar->display(); $bar->end();
or
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(); $bar->setDetails("My Custom Text"); $bar->display(); $bar->end();
Estimated time to completion is available. At least 2 iterations are required to calculate an ET.
The more iterations the better the estimate calculation will be.
use Siteworx\ProgressBar\CliProgressBar; $bar = new CliProgressBar(); $bar->displayTimeRemaining()->display(); $bar->end();
will output
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░ 50.0% (5/10) 02:14
Also update asynchronously with setDetails()
More features like:
- changing progress bar length (basicWithShortBar.php)
- changing bar color (colors.php)
- animation example (basic.php)
- etc...
in example directory.
Author: Półtorak Dariusz Contributors: @mathmatrix828 - Mason Phillips
License: MIT
siteworxpro/cli-progress-bar 适用场景与选型建议
siteworxpro/cli-progress-bar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 135.63k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 siteworxpro/cli-progress-bar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 siteworxpro/cli-progress-bar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 135.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-15
