PHP code example of aeno / php-slickprogress

1. Go to this page and download the library: Download aeno/php-slickprogress 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/ */

    

aeno / php-slickprogress example snippets


$progress = new \Aeno\SlickProgress\Progress();
$progress->start(50);

for ($i = 0; $i < 50; $i++) {
    $progress->advance();
    usleep(25000);
}

$progress->finish();

$theme = new \Aeno\SlickProgress\Theme\Simple();
$theme->showStep(true);
$theme->showPercent(true);

$progress = new \Aeno\SlickProgress\Progress($theme);
$progress->start(200);

for ($i = 0; $i < 200; $i++) {
    $progress->advance();
    usleep(25000);
}

$progress->finish();

$progress = new \Aeno\SlickProgress\Progress();
$progress->start(-1);

for ($i = 0; $i < 200; $i++) {
    $progress->advance();
    usleep(25000);
}

$progress->finish();

$foobar = new \Foobar();    // your business logic

$theme = new \Aeno\SlickProgress\Theme\Snake();
$theme->setColorType(\Aeno\SlickProgress\Colors::COLOR_TYPE_ANSI256);

$progress = new \Aeno\SlickProgress\Progress($theme);
$progress->start(-1);

for ($i = 0; $i < 100; $i++) {
    if ($foobar->hasNewStatus()) {
        $progress->setStatusMessage($foobar->getCurrentStatus());
    }

    $progress->advance();
    usleep(50000);
}

$progress->finish(\Aeno\SlickProgress\ThemeInterface::FINISH_TYPE_MESSAGE, '✅ Done!');
shell
composer