PHP Classes

PHP Console Progress Bar: Display bars for in-progress console tasks

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-07-12 (10 months ago) RSS 2.0 feedNot enough user ratingsTotal: 33 All time: 10,998 This week: 129Up
Version License PHP version Categories
progress 1.0.0MIT/X Consortium ...8Console, PHP 8
Description 

Author

This package can display bars for in-progress console tasks.

It can output characters to the console terminal on which a PHP script runs to show the progress of executing tasks.

The package can show multiple progress bars in the same terminal console at the same time in fixed positions.

Innovation Award
PHP Programming Innovation award nominee
July 2023
Number 4
Some developers created PHP scripts and tools to execute useful tasks from the command line terminal console.

Some of those scripts and tools need to execute tasks that may take a long time to finish.

In that case, it is useful to let the user know how much each task was executed.

This package can show multiple bars to show the progress of each running task.

This possibility is useful to show the detailed progress of complex tasks split into multiple levels of sub-tasks.

Manuel Lemos
Picture of Niko Peikrishvili
  Performance   Level  
Name: Niko Peikrishvili <contact>
Classes: 7 packages by
Country: Georgia Georgia
Age: ???
All time rank: 32004 in Georgia Georgia
Week rank: 298 Up1 in Georgia Georgia Up
Innovation award
Innovation award
Nominee: 4x

Example

<?php

use Progress\Progress;

require
__DIR__.'/../vendor/autoload.php';


foreach (
Progress::wrap(range(1, 4)) as $number) {
    foreach (
Progress::wrap(range(1, 5),'Second') as $secondNumber) {
        foreach (
Progress::wrap(range(1, 6), 'Third') as $thirdNumber) {
            {
               
usleep(20000);
            }
        }
    }
}


Details

Description

This is a simple wrapper around iterable variable with zero dependencies that uses generator to display progress in cli

Installation

composer require nikop/progress

Usage

<?php

use Progress\Progress;

require __DIR__.'/../vendor/autoload.php';


foreach (Progress::wrap(range(1, 4)) as $number) {
    foreach (Progress::wrap(range(1, 5),'Second') as $secondNumber) {
        foreach (Progress::wrap(range(1, 6), 'Third') as $thirdNumber) {
            {
                usleep(20000);
            }
        }
    }
}

Result

![](./examples/demo.gif)


Screenshots  
  • examples/demo.gif
  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file example.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file Progress.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:33
This week:0
All time:10,998
This week:129Up