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

v0.1.5 2025-11-16 21:27 UTC

This package is auto-updated.

Last update: 2025-11-16 21:27:44 UTC


README

TART Logo

Terminal Art for Artisan
A beautiful, expressive terminal UI toolkit for PHP console applications

PHP Version License Version

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

TART Example 1

TART Example 2

โœจ 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

๐Ÿ’ป 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:

  1. Run php artisan tart:demo to see the built-in showcase
  2. 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

Make your CLI applications beautiful with Terminal Art! ๐ŸŽจโœจ

Get Started โ€ข API Reference โ€ข Logos โ€ข Examples