PHP code example of handmade-medium / console-progress-bar

1. Go to this page and download the library: Download handmade-medium/console-progress-bar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

handmade-medium / console-progress-bar example snippets


// width of the left title column
$colWidth = 50;

// size of bar
$size = ConsoleProgressBar::SIZE_MEDIUM;

// max value of loop
$max = 100;

// text for column
$text = "Test";

// init
$progressBar = new ConsoleProgressBar($max, $size, $text, $colWidth);

// loop
for($x=1;$x<=$max;$x++) {
$progressBar->showProgress($x);
}

// end
$progressBar->showComplete();

> php examples/consoleExample.php

Example Spinner      [X] 100%
Example Small Bar    [=========================] 100%
Example Medium Bar   [==================================================] 100%
Example Large Bar    [====================================================================================================] 100%
Custom Bar           [##################################################] 100%
Custom Spinner       [X] 100%