konradmichalik / console-style-kit
Symfony Console Style Helper Extensions
0.1.0
2025-09-07 12:36 UTC
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
- symfony/console: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- armin/editorconfig-cli: ^1.0 || ^2.0
- eliashaeussler/php-cs-fixer-config: 2.3.0
- eliashaeussler/rector-config: ^3.0
- ergebnis/composer-normalize: ^2.44
- konradmichalik/php-doc-block-header-fixer: ^0.2
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.2 || ^11.0 || ^12.0
- roave/security-advisories: dev-latest
README
A PHP package for creating consistent and beautiful console output with various styling elements.
Warning
This package is in early development and may change significantly.
🔥 Installation
composer require konradmichalik/console-style-kit
⚡ Usage
Simple API
use ConsoleStyleKit\ConsoleStyleKit; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\ConsoleOutput; $style = new ConsoleStyleKit(new ArrayInput([]), new ConsoleOutput()); $style->blockquote('Important message', 'INFO'); $style->rating(5, 4); $style->showBadge('SUCCESS'); $style->loading('Processing data', 3); $loading = $style->loading('Processing'); // ... do work $loading->stop();
Note
Auto-update mode requires declare(ticks=1)
at the top of your PHP file to enable tick functions. The animation will update automatically on every PHP statement execution, providing smooth animation during long-running operations without any manual intervention. Always call ->start()
after ->enableAutoUpdate()
to ensure proper initialization.
Object-Oriented API
use ConsoleStyleKit\Elements\BlockquoteElement; use ConsoleStyleKit\Elements\RatingElement; use ConsoleStyleKit\Elements\BadgeElement; use ConsoleStyleKit\Elements\LoadingElement; use ConsoleStyleKit\Enums\BlockquoteType; use ConsoleStyleKit\Enums\RatingStyle; use ConsoleStyleKit\Enums\BadgeColor; use ConsoleStyleKit\Enums\LoadingCharacterSet; BlockquoteElement::create($style, 'Enhanced blockquote', BlockquoteType::WARNING)->render(); RatingElement::circle($style, 5, 4, true)->render(); BadgeElement::create($style, 'CUSTOM')->setColor(BadgeColor::BLUE)->render();
Output Examples
# Blockquote with type ┃ WARNING ┃ This is a warning message # Rating display ● ● ● ● ○ (4/5) # Badge SUCCESS # Timeline ● 2024-01-01 ─ Project Start │ ● 2024-06-01 ─ Milestone Reached │ ● 2024-12-01 ─ Project Complete # Loading Animation ⠋ Processing data …
Available Elements
- Blockquotes: INFO, TIP, IMPORTANT, WARNING, CAUTION
- Ratings: Circle and bar styles with colorful options
- Badges: Various colors and semantic types
- Separators: Customizable width and characters
- Key-Value pairs: With arrows and colors
- Timeline: Multi-event display with custom connectors
- Loading animations: Animated progress indicators with multiple styles and character sets
🧑💻 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
⭐ License
Licensed under GPL-3.0-or-later. See LICENSE for details.