PHPackages                             guiguiboy/php-cli-progress-bar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. guiguiboy/php-cli-progress-bar

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

guiguiboy/php-cli-progress-bar
==============================

Progress bar for PHP CLI scripts

0.0.4(11y ago)157597.2k↓54.1%18[6 issues](https://github.com/guiguiboy/PHP-CLI-Progress-Bar/issues)10MITPHPPHP &gt;=5.3.0

Since Nov 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/guiguiboy/PHP-CLI-Progress-Bar)[ Packagist](https://packagist.org/packages/guiguiboy/php-cli-progress-bar)[ Docs](https://github.com/guiguiboy/PHP-CLI-Progress-Bar)[ RSS](/packages/guiguiboy-php-cli-progress-bar/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (10)

PHP-CLI-Progress-Bar
====================

[](#php-cli-progress-bar)

A PHP5 CLI Progress bar Version 0.0.4

Requirements
============

[](#requirements)

PHP &gt;= 5.3

How it works
============

[](#how-it-works)

There is one namespace ProgressBar that contains 2 classes Manager and Registry.

Manager is responsible to manage the progress bar. Each instance of this class is associated with a Registry object. Each time the Manager needs to keep a metric, it is stored in this object.

When the display is requested, the script uses the string format and iterates over all replacement rules. Replacements are handled by closures.

The progress bar has the following default output : %current%/%max% \[%bar%\] %percent%% %eta%

It is configurable. You can also change it while processing your batch script.

Buit-in variable replacement are :

- %current% : the current element
- %max% : the number of elements
- %bar% : the progress bar
- %percent% : the advancement in percent
- %eta% : estimation of the remaining

Manager constructor arguments :

- current : the initial step
- max : the amount of steps in your process
- width : the max width of the line (default : 80)
- doneBarElementCharacter : a character to identify done advancement in the progress bar (default : =)
- remainingBarElementCharacter : a character to identify remaining advancement in the progress bar (default : -)
- currentPositionCharacter : a character to identify the current position in the progress bar (default : &gt;)

How to use
==========

[](#how-to-use)

Quick start
-----------

[](#quick-start)

Add include statements at the beginning of your script (if you don't have autoloaders)

```
