Download the PHP package guiguiboy/php-cli-progress-bar without Composer

On this page you can find all versions of the php package guiguiboy/php-cli-progress-bar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-cli-progress-bar

PHP-CLI-Progress-Bar

A PHP5 CLI Progress bar Version 0.0.4

Requirements

PHP >= 5.3

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 :

Manager constructor arguments :

How to use

Quick start

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

Will output :

1/10 [===>----------------------------------------------] 10.00% 00:00:09

When you want to iterate over a collection, you don't event need to track the counter:

Configuration

Changing the output

Use the setFormat() method :

Will output :

1|>-------------------------------------------------------------------| 10

Changing the max length

The max length is specified in the constructor :

Will output :

1/20 [====>----------------------------------------------------------------------------------------] 5.00% 00:00:00

Changing the progress bar style

Use the parameters specified in the constructor :

Will output :

5/20 [-----------------------) ] 25.00% 00:00:00

Extending

Adding custom replacement rules

You may add your custom variables for replacement. You have to use the method addReplacementRule and specify a priority, a tag and a closure. Keep in mind that the length of the progress bar is evaluated at the end so that the output width will scale up to the width you specified. So keeping the %bar% with a high priority is a good practice.

Here is an example of what you should do if you want to add a new replacement rule.

Will echo :

Progress : 1/213 [>---------------------------------------------------] OK!

ChangeLog

0.0.3 -> 0.0.4

0.0.2 -> 0.0.3

0.0.1 -> 0.0.2

TODO


All versions of php-cli-progress-bar with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package guiguiboy/php-cli-progress-bar contains the following files

Loading the files please wait ....