symfony/symfony — pull request #12119 by kbond (2014-10-03 19:15:46+00:00)
Title: [PoC][Console] Add progress indicator helper

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | *todo*
| Fixed tickets | n/a
| License | MIT
| Doc PR | *todo*

A lot of work needs to be done still but thought I would get some comments on this idea.

Example code:

```php
$progress = new ProgressIndicator($output);
$progress->start('Starting...');

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

switch ($i) {
case 20:
$progress->setMessage('Just started...');
break;
case 50:
$progress->setMessage('Half way...');
break;
case 90:
$progress->setMessage('Almost Done...');
break;
}
}

$progress->finish('Done.');
```

Screenshot:

![output](https://cloud.githubusercontent.com/assets/127811/4511167/95302026-4b31-11e4-824e-5cb26f96e4cb.gif)