divineomega/php-cli-progress-bar

Progress bar for command line PHP scripts

Fund package maintenance!
DivineOmega

v2.1.0 2020-02-06 21:58 UTC

This package is auto-updated.

Last update: 2024-02-07 06:55:34 UTC


README

Progress bar for command line PHP scripts.

Example of PHP CLI Progress Bar

Installation

To install, just run the following Composer command.

composer require divineomega/php-cli-progress-bar

Usage

The following code snippet shows a basic usage example.

$max = 250;

$progressBar = new DivineOmega\CliProgressBar\ProgressBar;
$progressBar->setMaxProgress($max);

for ($i=0; $i < $max; $i++) { 
    usleep(200000); // Instead of usleep, process a part of your long running task here.
    $progressBar->advance()->display();
}

$progressBar->complete();