Progress bars in Symfony commands

Code
<?php

use Symfony\Component\Console\Helper\ProgressBar;
use 
Symfony\Component\Console\Output\StreamOutput;

$stream fopen('php://output''w');
$output = new StreamOutput($stream);

$progressBar = new ProgressBar($output);

$loop = ['a','b','c','d','e'];
$progressBar->start(count($loop));

// In CLI, the progress bar updates with every loop
foreach ($loop as $element) {
    echo 
PHP_EOL.'<b>'.$element.'</b>';
    
$progressBar->advance();
}
Result
0/5 [>---------------------------] 0%
a
b
c
d
e
5/5 [============================] 100%
Used Versions
PHP 7.4, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8