PHP code example of alex-heifetz / progress-bar
1. Go to this page and download the library: Download alex-heifetz/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/ */
alex-heifetz / progress-bar example snippets
// Import ProgressBar class into the global namespace
use Heifetz\ProgressBar;
// Load Composer's autoloader
et the redraw delay in milliseconds.
$pb->setRenderDelay(100);
// Optional: count errors separately.
// Disable this if failed iterations should be counted as completed iterations.
$pb->setSeparateErrors(true);
for ($i = 0; $i < $count; $i++) {
if (mt_rand(0, 5)) {
// Advance the process by one iteration
$pb->advance();
} else {
// Advance the process by one iteration with error
$pb->advanceError();
}
}
// We indicate the completion of the progress bar to render the final state
$pb->finish();