PHPackages                             kas-cor/console-progress-bar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. kas-cor/console-progress-bar

ActiveLibrary[CLI &amp; Console](/categories/cli)

kas-cor/console-progress-bar
============================

Console progress bar

0.1.0(1mo ago)155MITPHPPHP &gt;=8.4

Since Sep 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kas-cor/console-progress-bar)[ Packagist](https://packagist.org/packages/kas-cor/console-progress-bar)[ Docs](https://github.com/kas-cor/console-progress-bar)[ Fund](https://bit.ly/3uVaKEu)[ RSS](/packages/kas-cor-console-progress-bar/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (4)Versions (7)Used By (0)

Console progress bar
====================

[](#console-progress-bar)

[![CI](https://github.com/kas-cor/console-progress-bar/actions/workflows/ci.yml/badge.svg)](https://github.com/kas-cor/console-progress-bar/actions/workflows/ci.yml) [![Latest Version](https://camo.githubusercontent.com/ff0c14d2eb390d28c0143cfdf7bf731a58b10ba058eb3d4f422f304612df4dab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61732d636f722f636f6e736f6c652d70726f67726573732d6261722e737667)](https://packagist.org/packages/kas-cor/console-progress-bar) [![Total Downloads](https://camo.githubusercontent.com/15e51e72d815208770bdfabbaab3a9a637cfe2c684687c5f7ed8c51832671b04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61732d636f722f636f6e736f6c652d70726f67726573732d6261722e737667)](https://packagist.org/packages/kas-cor/console-progress-bar) [![PHP Version](https://camo.githubusercontent.com/81a857a07cbece14b8408ea2f18b726e180421bac263b56b909dddd92e7073ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b61732d636f722f636f6e736f6c652d70726f67726573732d6261722e737667)](https://packagist.org/packages/kas-cor/console-progress-bar)

> **Русская версия:** [README\_ru.md](README_ru.md)

A lightweight, customizable progress bar for PHP CLI applications. Supports spinners, time tracking, percentage display, and pluggable output handlers (console, PSR-3 logger, callback).

Screenshots
-----------

[](#screenshots)

### In process

[](#in-process)

[![In process](https://github.com/kas-cor/console-progress-bar/raw/main/in_process.png)](https://github.com/kas-cor/console-progress-bar/raw/main/in_process.png)

### Finish report

[](#finish-report)

[![Finish report](https://github.com/kas-cor/console-progress-bar/raw/main/finish_report.png)](https://github.com/kas-cor/console-progress-bar/raw/main/finish_report.png)

Features
--------

[](#features)

- Spinner animation with customizable character set
- Progress bar with configurable size and fill/empty characters
- Current position display (`005/100`)
- Percentage progress (`50.00%`)
- Passed and estimated remaining time
- Timestamped messages
- Finish report on completion
- Pluggable output — console, PSR-3 logger, or custom callback
- Fully configurable element order and visibility

Install
-------

[](#install)

```
composer require kas-cor/console-progress-bar
```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4
- `ext-mbstring`

Quick start
-----------

[](#quick-start)

```
use KasCor\ConsoleProgressBar;

$progressBar = new ConsoleProgressBar(5);

foreach (range(1, 5) as $current_position) {
    $progressBar->output($current_position, 'message');
    sleep(1);
}
```

Usage
-----

[](#usage)

### Default config

[](#default-config)

```
use KasCor\ConsoleProgressBar;

$progressBar = new ConsoleProgressBar(5);

foreach (range(1, 5) as $current_position) {
    $progressBar->output($current_position);
    sleep(1);
}
```

### Custom config

[](#custom-config)

```
use KasCor\ConsoleProgressBar;

$progressBar = new ConsoleProgressBar(5, [
    'showFinishReport'  => false,
    'progressBarSize'   => 30,
    'progressBarFullChar' => '=',
    'progressBarEmptyChar' => '-',
]);

foreach (range(1, 5) as $current_position) {
    $progressBar->output($current_position, 'message');
    sleep(1);
}
```

### Custom output handler

[](#custom-output-handler)

The progress bar supports pluggable output handlers via `OutputInterface`. Three built-in handlers are available:

HandlerDescription`ConsoleOutput`Default — writes directly to STDOUT via `echo``CallbackOutput`Delegates output to a user-provided callback`LoggerOutput`Routes output to a PSR-3 logger#### Callback output

[](#callback-output)

```
use KasCor\ConsoleProgressBar;
use KasCor\Output\CallbackOutput;

$captured = '';
$output = new CallbackOutput(function (string $text) use (&$captured): void {
    $captured .= $text;
});

$progressBar = new ConsoleProgressBar(5, [], $output);

foreach (range(1, 5) as $current_position) {
    $progressBar->output($current_position);
    sleep(1);
}
```

#### PSR-3 logger output

[](#psr-3-logger-output)

```
use KasCor\ConsoleProgressBar;
use KasCor\Output\LoggerOutput;

// Requires psr/log: composer require psr/log
$psrLogger = new \Monolog\Logger('progress', [new \Monolog\Handler\StreamHandler('php://stdout')]);
$output = new LoggerOutput($psrLogger);

$progressBar = new ConsoleProgressBar(5, [], $output);

foreach (range(1, 5) as $current_position) {
    $progressBar->output($current_position);
    sleep(1);
}
```

#### Changing output at runtime

[](#changing-output-at-runtime)

```
$progressBar->setOutput($customOutput);
$output = $progressBar->getOutput();
```

#### Custom log level

[](#custom-log-level)

```
$output = new LoggerOutput($logger, \Psr\Log\LogLevel::DEBUG);
```

### Without parameters

[](#without-parameters)

```
$progressBar = new ConsoleProgressBar(5);
for ($i = 1; $i output(); // uses internal position counter
    sleep(1);
}
```

### Manual finish report

[](#manual-finish-report)

```
$progressBar = new ConsoleProgressBar(5, ['showFinishReport' => false]);
foreach (range(1, 5) as $i) {
    $progressBar->output($i);
    sleep(1);
}
$progressBar->finishReport(); // print manually
```

Config reference
----------------

[](#config-reference)

PropertyTypeDescriptionDefaultshowTimeMessagebooleanShow timestamp before message`true`showBarbooleanShow progress bar `[###...]``true`showCurrentPositionbooleanShow current position `005/100``true`showSpinnerbooleanShow spinner animation`true`showPercentbooleanShow percentage `50.00%``true`showPassedTimebooleanShow passed time`true`showEstimatedTimebooleanShow estimated remaining time`true`showFinishReportbooleanShow finish report on completion`true`timeMessageFormatstringPHP date format for timestamps`d.m.Y H:i:s`progressBarSizeintWidth of the progress bar in characters`50`progressBarFullCharstringCharacter for filled portion`#`progressBarEmptyCharstringCharacter for empty portion`.`spinnerCharsarraySpinner animation frames`['-', '\\', '|', '/']`separatorstringSeparator between elements`-`orderElementsarrayElement order`['spinner', 'progress_bar', 'current_position', 'percent', 'passed_time', 'estimated_time']`Methods reference
-----------------

[](#methods-reference)

MethodDescription`output(?int $position, ?string $message)`Update and display the progress bar`getProgressData(): array`Get current progress data (percent, times, position)`finishReport(): void`Print the finish report manually`setOutput(OutputInterface $output): void`Set a custom output handler`getOutput(): OutputInterface`Get the current output handler### `getProgressData()` return value

[](#getprogressdata-return-value)

```
[
    'limit'           => float,   // total limit
    'current_position' => int,    // current position
    'percent'         => float,   // 0–100
    'passed_time'     => ['days' => int, 'hours' => int, 'minutes' => int, 'seconds' => int],
    'estimated_time'  => ['days' => int, 'hours' => int, 'minutes' => int, 'seconds' => int],
]
```

Contributing
------------

[](#contributing)

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on development workflow, coding standards, and pull request process.

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md).

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance68

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~529 days

Total

5

Last Release

30d ago

PHP version history (2 changes)0.0.1PHP &gt;=7.2.0

0.1.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3366723?v=4)[Alexsander](/maintainers/kas-cor)[@kas-cor](https://github.com/kas-cor)

---

Top Contributors

[![kas-cor](https://avatars.githubusercontent.com/u/3366723?v=4)](https://github.com/kas-cor "kas-cor (20 commits)")

---

Tags

consoleprogress-barconsoleprogressbar

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kas-cor-console-progress-bar/health.svg)

```
[![Health](https://phpackages.com/badges/kas-cor-console-progress-bar/health.svg)](https://phpackages.com/packages/kas-cor-console-progress-bar)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.4M2.2k](/packages/symfony-symfony)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k257.3M12.4k](/packages/symfony-framework-bundle)[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k61.7M839](/packages/drush-drush)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k190.0M2.6k](/packages/symfony-security-bundle)[symfony/web-profiler-bundle

Provides a development tool that gives detailed information about the execution of any request

2.3k164.3M1.4k](/packages/symfony-web-profiler-bundle)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2949.6M274](/packages/helhum-typo3-console)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
