2017 © Pedro Peláez
 

package phpprogress

Here is a PHP function that shows progress in nice view in command-line interface (CLI)

image

masterklavi/phpprogress

Here is a PHP function that shows progress in nice view in command-line interface (CLI)

  • Saturday, May 13, 2017
  • by masterklavi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

PHP Progress

Using it you can give nice progress view in command-line interface (CLI), (*1)

Example

use masterklavi\phpprogress\Progress;

// init progress of 500 tasks
$progress = new Progress(500);

for ($i = 0; $i < 500; $i++)
{
    // some task
    usleep(rand(0, 50000));

    // mark that a task was completed
    $progress->show();
}

Requirements

  • PHP version 5.4.0 or higher

Installation

Using Composer

Get the package:, (*2)

$ composer require masterklavi/phpprogress

Manual Installation

Clone git repository:, (*3)

$ git clone https://github.com/masterklavi/phpprogress.git

or download the package at https://github.com/masterklavi/phpprogress/archive/master.zip, (*4)

Small Documentation

  • Progress::__construct($max) where $max - max value (count of tasks)
  • Progress::show($offset_or_value = 1, $progress_type = Progress::TYPE_OFFSET, $status = Progress::STATUS_OK) where
    • $offset_or_value - offset (when type=OFFSET) or value (when type=VALUE)
    • $progress_type can be Progress::TYPE_OFFSET or Progress::TYPE_VALUE
    • $status can be Progress::STATUS_OK, Progress::STATUS_SKIP or Progress::STATUS_FAIL
$progress = new Progress(10);
$progress->show(); // offset = 1, so value = 1
$progress->show(2); // offset = 2, so value = 3
$progress->show(6, Progress::TYPE_VALUE); // value = 6
$progress->show(4); // offset = 2, so value = 10

The Versions

13/05 2017

dev-master

9999999-dev

Here is a PHP function that shows progress in nice view in command-line interface (CLI)

  Sources   Download

The Requires

  • php >=5.4.0

 

11/05 2017

v0.3.0

0.3.0.0

Here is a PHP function that shows progress in nice view in command-line interface (CLI)

  Sources   Download

The Requires

  • php >=5.4.0

 

11/05 2017

v0.2.0

0.2.0.0

Here is a PHP function that shows progress in nice view in command-line interface (CLI)

  Sources   Download

The Requires

  • php >=5.4.0

 

11/05 2017

v0.1.0

0.1.0.0

Here is a PHP function that shows progress in nice view in command-line interface (CLI)

  Sources   Download

The Requires

  • php >=5.4.0