igclabs / tart
TART (Terminal Art for Artisan) - A beautiful, expressive terminal UI toolkit for PHP console applications with automatic logo generation, themes, and rich formatting
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/igclabs/tart
Requires
- php: ^8.0
- symfony/console: ^5.0|^6.0|^7.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0|^10.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.0|^10.0
Suggests
- illuminate/console: Required for Laravel integration (^9.0|^10.0)
README
Terminal Art for Artisan
A beautiful, expressive terminal UI toolkit for PHP console applications
Why TART?
Transform boring CLI commands into beautiful, professional applications with styled output, themed blocks, automatic logo generation, and more. Make your terminal applications a joy to use and a work of art!
$this->displayTextLogo('MY APP', 'box', ['text_color' => 'cyan']); $this->say('Processing data...'); $this->good('โ Step 1 complete'); $this->success('๐ Deployment complete!');
๐ธ Examples in Action
โจ Features
- ๐จ Rich Formatting - Colored text, backgrounds, and styled blocks
- ๐ฆ Block Messages - Beautiful success, warning, error, and info blocks
- ๐ท๏ธ Automatic Logos - Create branded ASCII art logos with one line of code
- ๐ญ Theme System - Built-in themes or create your own
- ๐ Progress Indicators - Build output line-by-line with columns
- ๐ง Framework Agnostic - Works with Laravel, Symfony, or standalone
- โจ Emoji Support - Full multi-byte UTF-8 character support
- ๐งฉ Modular - Use only what you need with traits
- โก Easy API - Simple, expressive, intuitive
Installation
composer require igclabs/tart
Verify Installation
After requiring the package, you can confirm that Composer resolved the correct package by inspecting it:
composer show igclabs/tart # name : igclabs/tart # versions : * 1.1.0
Quick Start
Laravel
<?php namespace App\Console\Commands; use IGC\Tart\Laravel\StyledCommand; class DeployCommand extends StyledCommand { protected $signature = 'app:deploy'; public function handle() { // Beautiful branded logo $this->displayTextLogo('DEPLOYMENT SYSTEM', 'box', [ 'text_color' => 'cyan', ]); $this->br(); // Progress tracking $this->openLine('Building application'); // ... work ... $this->appendLine(' โ', 'green'); $this->closeLine(); $this->openLine('Running tests'); // ... work ... $this->appendLine(' โ', 'green'); $this->closeLine(); // Success finish $this->br(); $this->success('๐ Deployment Complete!'); return self::SUCCESS; } }
Example Usage
See the complete example in examples/laravel-example.php
Symfony Console
<?php namespace App\Command; use IGC\Tart\Symfony\StyledCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class DeployCommand extends StyledCommand { protected static $defaultName = 'app:deploy'; protected function execute(InputInterface $input, OutputInterface $output): int { $this->header('Deployment (Symfony)'); $this->say('Shipping bits via Symfony Console!'); $this->success('Done!'); return Command::SUCCESS; } }
Need custom defaults outside Laravel? Pass overrides into the constructor:
new DeployCommand('app:deploy', [ 'theme' => [ 'class' => \IGC\Tart\Themes\Theme::class, 'color' => 'purple', 'max_line_width' => 100, ], ]);
Laravel Auto-Discovery & Demo Command
Laravel 9+ automatically discovers the IGC\Tart\Laravel\TartServiceProvider, which registers the tart:demo Artisan command. After installing the package you can immediately preview the styling toolkit:
php artisan tart:demo
Need manual control? Add TART to Composer's dont-discover list and register the provider in config/app.php:
{
"extra": {
"laravel": {
"dont-discover": [
"igclabs/tart"
]
}
}
}
// config/app.php 'providers' => [ // ... IGC\Tart\Laravel\TartServiceProvider::class, ],
Publish Configuration
Publish the default configuration to tweak the base theme, logo colors, or auto-answer behavior:
php artisan vendor:publish --tag=tart-config
config/tart.php lets you point to a custom ThemeInterface implementation or adjust the palette/width used by the bundled Theme class.
๐ Core Features
Basic Output
$this->say('Regular message'); $this->good('โ Success message'); // Green $this->bad('โ Error message'); // Red $this->state('โ Status message'); // Yellow $this->cool('โน Info message'); // Cyan
Block Messages
$this->header('Processing'); // Large header $this->title('Section Title'); // Title block $this->success('Operation succeeded!'); // Green block $this->warning('Check this issue'); // Red block $this->notice('Important info'); // Cyan block $this->failure('Operation failed'); // Error block $this->stat('Completed in 2.5s'); // Stat block $this->footer('Process', 'Time: 2.5s'); // Footer
Logo Creation ๐จ
// Simple text logo $this->displayTextLogo('MY APP'); // Boxed logo (emphasis) $this->displayTextLogo('DEPLOYMENT', 'box', [ 'text_color' => 'green', ]); // Banner logo (separators) $this->displayTextLogo('BUILD COMPLETE', 'banner'); // Custom ASCII art $asciiArt = <<<'ASCII' ____ ____ ___ _____ ____ | _ \| _ \ / _ \| ___/ ___| | |_) | |_) | | | | |_ \___ \ | __/| _ <| |_| | _| ___) | |_| |_| \_\\___/|_| |____/ ASCII; $this->displayAsciiLogo($asciiArt, [ 'colors' => ['cyan', 'blue', 'white'], ]);
Line Building & Columns
// Progressive output $this->openLine('Processing users'); // ... do work ... $this->appendLine(' โ Done', 'green'); $this->closeLine(); // Table-like columns $this->openLine('User'); $this->addColumn('John Doe', 25, 'white'); $this->addColumn('Active', 15, 'green'); $this->addColumn('Admin', 10, 'cyan'); $this->closeLine();
Layout
$this->br(); // Blank line $this->br(3); // 3 blank lines $this->hr(); // Horizontal rule
๐จ Themes
use IGC\Tart\Themes\{DefaultTheme, SuccessTheme, ErrorTheme, Theme}; // Use built-in theme $this->setTheme(new SuccessTheme()); $this->header('Success Operations'); // Create custom theme $theme = new Theme( color: 'purple', textColor: 'white', highlightColor: 'yellow', maxLineWidth: 80 ); $this->setTheme($theme);
Built-in Themes:
DefaultTheme- Blue (general use)SuccessTheme- Green (success operations)ErrorTheme- Red (error handling)
๐ Documentation
- Getting Started - Installation and first steps
- Quick Reference - Complete API reference
- Logo Creation - Logo generation guide
- Examples - Working code examples
๐ป Examples
Check out the working examples in the examples/ directory:
Built-in Demo Command
# Auto-registered when the package is installed in Laravel
php artisan tart:demo
Quick Demo Source
# Basic demo showing the same features inside your editor
cat examples/demo-command.php
Comprehensive Demo
# Full showcase of all TART capabilities
cat examples/comprehensive-demo.php
Laravel Integration
# Complete Laravel command example
cat examples/laravel-example.php
Try it yourself:
- Run
php artisan tart:demoto see the built-in showcase - Copy any example to your Laravel
app/Console/Commands/directory when you're ready to customize your own command
๐ก Use Cases
Application Branding
public function handle() { $this->displayTextLogo('PROFSS PLATFORM', 'box', [ 'text_color' => 'cyan', ]); // ... application logic ... }
Progress Tracking
$items = ['Users', 'Posts', 'Comments']; foreach ($items as $item) { $this->openLine("Processing {$item}"); // ... process ... $this->appendLine(' โ', 'green'); $this->closeLine(); }
Status Reports
$this->say('System Status:'); $this->good('โ Database: Connected'); $this->good('โ Cache: Operational'); $this->bad('โ API: Connection timeout'); $this->stat('Report generated in 1.2s');
Themed Operations
$this->setTheme(new SuccessTheme()); $this->header('Deployment'); // ... deployment logic ... $this->displayTextLogo('SUCCESS', 'banner', [ 'text_color' => 'green', ]);
๐๏ธ Architecture
TART uses a modular trait-based architecture:
- HasColoredOutput - Basic colored text output
- HasBlocks - Block-style formatted messages
- HasLineBuilding - Build lines incrementally
- HasInteractivity - Interactive prompts
Mix and match traits in your own classes for maximum flexibility.
๐งช Testing
composer install
composer test
Requirements
- PHP 8.0 or higher
- Symfony Console 5.0+ or 6.0+
- Laravel 9.0+ (for Laravel integration)
- mbstring extension (standard in most PHP installations)
๐ฆ What's Included
- โ 15+ output methods
- โ 7 block message types
- โ 3 logo styles (standard, box, banner)
- โ Theme system with 3 built-in themes
- โ Multi-byte character support (emojis!)
- โ Unit and integration tests
- โ Complete documentation
- โ Working examples
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
๐ License
MIT License - see LICENSE for details.
๐ Credits
Developed by the IGC team. Extracted from internal tooling and open-sourced for the community.
๐ Resources
- Getting Started: docs/GETTING-STARTED.md
- Quick Reference: docs/guides/QUICK-REFERENCE.md
- Logo Creation: docs/guides/LOGO-CREATION.md
- Examples: examples/README.md
Make your CLI applications beautiful with Terminal Art! ๐จโจ
Get Started โข API Reference โข Logos โข Examples