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

On this page you can find all versions of the php package nickbeen/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

Latest version Build status Total downloads PHP Version License

For creating minimal progress bars in PHP CLI scripts. It has no dependencies, but requires PHP 8.0 or higher. This library is mainly built for iterating to countable variables, but also works easily with ticking through less structured step-by-step scripts.

Many PHP CLI progress bars have been written in the past, but most haven't been updated in years. This library uses the latest PHP features such as return types, named arguments and constructor property promotions. For creating richer, more customizable progress bars, check alternatives such as the progress bar helper included in the symfony/console package.

Requirements

Installation

Install the library into your project with Composer.

Usage

With this library you can display a progress bar in a PHP CLI script to indicate the script is doing its work and how far it has progressed. All you need to do is start displaying the progress bar, tick through the steps the script goes through and finish the display of the progress bar.

Manually progressing

It is possible to tick through the steps of your scripts manually when the steps in your script cannot be looped. Each tick adds one progression, but you can override the progression made by including an integer in tick().

You do need to set maxProgress for the progress bar to display the correct numbers by including it in the constructor. If you don't know the maxProgress during initialization, you can set it later with the setMaxProgress() method.

If you have a little more structure in your step-by-step code, you can easily place tick() in a for loop. There is however a more convenient method when dealing with e.g. arrays.

Iterating through arrays or traversable instances

This class method works with anything of the pseudo-type iterable which includes any array or any instance of Traversable. The iterate() method automatically handles starting the progress bar, managing ticking through the iteration and finally finish displaying the progress bar.

Interact with the progress bar

It is possible to interact with the progress bar during its run. You can retrieve the estimated time to finish, the progress it has made, the maximum progress that has been set and the amount of completion in percentage. You can use this information e.g. for notifications or other tasks in the background.

License

This library is licensed under the MIT License (MIT). See the LICENSE for more details.


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

PHP Build Version
Package Version
Requires php Version ^8.0
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 nickbeen/php-cli-progress-bar contains the following files

Loading the files please wait ....