承接 alex-heifetz/progress-bar 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alex-heifetz/progress-bar

最新稳定版本:1.3.2

Composer 安装命令:

composer require alex-heifetz/progress-bar

包简介

PHP CLI progress bar

README 文档

README

GitHub Release GitHub Downloads (all assets, all releases) GitHub License Packagist Dependency Version

Gif

Features

  • Compatible with PHP 7.4 and later
  • Displays estimated completion time
  • It is possible to divide into 2 parts, for example with successful iterations and with erroneous ones
  • Flexibly responds to changes in window width
  • It is possible to configure the data update time

Why you might need this

Sometimes when running commands and long processes or testing commands, you want to see that the process is moving and not hanging in the middle. I would also like to understand the approximate completion time of the process. This library was created to solve these problems.

Installation & loading

Just add this line to your composer.json file:

"alex-heifetz/progress-bar": "^1.2"

or run

composer require seraph90/progress-bar

A Simple Example

<?php

// Import ProgressBar class into the global namespace
use Heifetz\ProgressBar;

// Load Composer's autoloader
require 'vendor/autoload.php';

$count = 12000000;

// Create an instance;
// Passing total count of iterations 
$pb = new ProgressBar($count);

// Set the delay time between redrawings
$pb->setRenderDelay(100);

for ($i = 0; $i < $count; $i++) {
    if (mt_rand(0, 5)) {
        // Advance the process by one iteration
        $pb->advance();
    } else {
        // Advance the process by one iteration with error
        $pb->advanceError();
    }
}

// We indicate the completion of the progress bar to render the final state
$pb->finish();

ProgresBar

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-09-08