PHP code example of igclabs / tart

1. Go to this page and download the library: Download igclabs/tart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

igclabs / tart example snippets


// New fluent APIs (recommended)
$this->logo()
    ->text('MY APP')
    ->boxed()
    ->color('cyan')
    ->render();

$this->say('Processing data...');
$this->good('✓ Step 1 complete');
$this->success('🎉 Deployment complete!');

// Or use the traditional API (still supported)
$this->displayTextLogo('MY APP', 'box', ['text_color' => 'cyan']);
$this->say('Processing data...');
$this->good('✓ Step 1 complete');
$this->success('🎉 Deployment complete!');



namespace App\Console\Commands;

use IGC\Tart\Laravel\StyledCommand;

class DeployCommand extends StyledCommand
{
    protected $signature = 'app:deploy';
    
    public function handle()
    {
        // Beautiful branded logo (fluent API)
        $this->logo()
            ->text('DEPLOYMENT SYSTEM')
            ->boxed()
            ->color('cyan')
            ->render();
        
        $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;
    }
}



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;
    }
}

new DeployCommand('app:deploy', [
    'theme' => [
        'class' => \IGC\Tart\Themes\Theme::class,
        'color' => 'magenta',
        'max_line_width' => 100,
    ],
]);

new DeployCommand('app:deploy', [
    'theme' => [
        'class' => \IGC\Tart\Themes\Theme::class,
        'color' => 'magenta',
        'text_color' => 'white',
        'highlight_color' => 'yellow',
        'max_line_width' => 100,
        'colors' => ['magenta', 'cyan', 'white'],
    ],
]);

$theme = \IGC\Tart\Themes\Theme::make('green')
    ->withTextColor('white')
    ->withHighlightColor('yellow')
    ->withMaxWidth(90)
    ->withColors(['green', 'cyan', 'white']);

// config/app.php
'providers' => [
    // ...
    IGC\Tart\Laravel\TartServiceProvider::class,
],

$this->say('Regular message');
$this->good('✓ Success message');         // Green
$this->bad('✗ Error message');            // Red
$this->state('⚠ Status message');         // Yellow
$this->cool('ℹ Info message');            // Cyan

$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

$this->logo()
    ->text('MY APP')
    ->boxed()
    ->color('cyan')
    ->render();

$this->success('Deploy complete!');

$this->displayTextLogo('MY APP', 'box', ['text_color' => 'cyan']);
$this->success('Deploy complete!');

// Fluent API (recommended)
$this->logo()
    ->text('MY APP')
    ->render();

$this->logo()
    ->text('DEPLOYMENT')
    ->boxed()
    ->color('green')
    ->render();

$this->logo()
    ->text('BUILD COMPLETE')
    ->banner()
    ->render();

// ASCII art with fluent API
$asciiArt = <<<'ASCII'
  ____  ____   ___  _____  ____
 |  _ \|  _ \ / _ \|  ___/ ___|
 | |_) | |_) | | | | |_  \___ \
 |  __/|  _ <| |_| |  _|  ___) |
 |_|   |_| \_\\___/|_|   |____/
ASCII;

$this->logo()
    ->ascii($asciiArt)
    ->colors(['cyan', 'blue', 'white'])
    ->render();

// Traditional API (still supported)
$this->displayTextLogo('MY APP');
$this->displayTextLogo('DEPLOYMENT', 'box', ['text_color' => 'green']);
$this->displayTextLogo('BUILD COMPLETE', 'banner');
$this->displayAsciiLogo($asciiArt, ['colors' => ['cyan', 'blue', 'white']]);

// 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();

$this->br();        // Blank line
$this->br(3);       // 3 blank lines
$this->hr();        // Horizontal rule

use IGC\Tart\Themes\{DefaultTheme, SuccessTheme, ErrorTheme, Theme};

// Fluent theme creation (recommended)
$theme = Theme::make('magenta')
    ->withTextColor('white')
    ->withHighlightColor('yellow')
    ->withMaxWidth(80);

$this->setTheme($theme);
$this->header('Success Operations');

// Use built-in theme
$this->setTheme(new SuccessTheme());
$this->header('Success Operations');

// Traditional theme creation (still supported)
$theme = new Theme(
    color: 'magenta',
    textColor: 'white',
    highlightColor: 'yellow',
    maxLineWidth: 80
);
$this->setTheme($theme);

public function handle()
{
    // Fluent logo creation
    $this->logo()
        ->text('PROFSS PLATFORM')
        ->boxed()
        ->color('cyan')
        ->render();

    // ... application logic ...
}

$items = ['Users', 'Posts', 'Comments'];

foreach ($items as $item) {
    $this->openLine("Processing {$item}");
    // ... process ...
    $this->appendLine(' ✓', 'green');
    $this->closeLine();
}

$this->say('System Status:');
$this->good('✓ Database: Connected');
$this->good('✓ Cache: Operational');
$this->bad('✗ API: Connection timeout');
$this->stat('Report generated in 1.2s');

// Fluent theme creation
$theme = Theme::make('green')
    ->withTextColor('white')
    ->withHighlightColor('yellow');

$this->setTheme($theme);
$this->header('Deployment');
// ... deployment logic ...
$this->logo()
    ->text('SUCCESS')
    ->banner()
    ->color('green')
    ->render();
bash
php artisan vendor:publish --tag=tart-config
bash
# Complete Laravel command example
cat examples/laravel-example.php