PHP Classes

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

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 34 All time: 11,063 This week: 63Up
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
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 (1)  
  • examples/demo.gif
  Files folder image Files (5)  
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 (5)  /  examples  
File Role Description
  Accessible without login Plain text file example.php Example Example script

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:0
All time:11,063
This week:63Up