Download the PHP package kas-cor/console-progress-bar without Composer
On this page you can find all versions of the php package kas-cor/console-progress-bar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kas-cor/console-progress-bar
More information about kas-cor/console-progress-bar
Files in kas-cor/console-progress-bar
Package console-progress-bar
Short Description Console progress bar
License MIT
Homepage https://github.com/kas-cor/console-progress-bar
Informations about the package console-progress-bar
Console progress bar
Русская версия: 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
In process

Finish report

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
Requirements
- PHP >= 8.4
ext-mbstring
Quick start
Usage
Default config
Custom config
Custom output handler
The progress bar supports pluggable output handlers via OutputInterface. Three built-in handlers are available:
| Handler | Description |
|---|---|
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
PSR-3 logger output
Changing output at runtime
Custom log level
Without parameters
output() keeps the previous position when called without a position argument — it does not advance automatically. Pass the position explicitly to advance the bar:
To print a message without changing the position, use output(null, 'message').
Manual finish report
Config reference
| Property | Type | Description | Default |
|---|---|---|---|
| showTimeMessage | boolean | Show timestamp before message | true |
| showBar | boolean | Show progress bar [###...] |
true |
| showCurrentPosition | boolean | Show current position 005/100 |
true |
| showSpinner | boolean | Show spinner animation | true |
| showPercent | boolean | Show percentage 50.00% |
true |
| showPassedTime | boolean | Show passed time | true |
| showEstimatedTime | boolean | Show estimated remaining time | true |
| showFinishReport | boolean | Show finish report on completion | true |
| timeMessageFormat | string | PHP date format for timestamps | d.m.Y H:i:s |
| progressBarSize | int | Width of the progress bar in characters | 50 |
| progressBarFullChar | string | Character for filled portion | # |
| progressBarEmptyChar | string | Character for empty portion | . |
| spinnerChars | array | Spinner animation frames | ['-', '\\', '\|', '/'] |
| separator | string | Separator between elements | - |
| orderElements | array | Element order | ['spinner', 'progress_bar', 'current_position', 'percent', 'passed_time', 'estimated_time'] |
Methods reference
| Method | Description |
|---|---|
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
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines on development workflow, coding standards, and pull request process.
Changelog
See CHANGELOG.md.
License
MIT
All versions of console-progress-bar with dependencies
ext-mbstring Version *