Totally RAD Terminal styling for PHP!

Fluent and incredible powerful, object-oriented interface for customizing CLI output text color, background, formatting, theming and more.

Install composer require thermage/thermage

Features

Consistent Colors

Terminal
$ php thermage.php
Thermage uses the ANSI color scheme which is widely used by terminals to ensure consistent colors in different terminal themes. If that’s not enough, Thermage can be used to access the full RGB color scheme (16+ million colors) in terminals that support TrueColor.

Component System

Terminal
$ php thermage.php
Stay RAD!
Stay RAD!
Stay RAD!
Stay RAD!
Terminal
$ php thermage.php
Apple17% (100)
Orange46% (270)
Lime37% (220)


Apple 17% (100) Orange 46% (270) Lime 37% (220)
Terminal
$ php thermage.php
Terminal
$ php thermage.php
Stay RAD!

Stay RAD!

Stay RAD!

Stay RAD!

Stay RAD!
Terminal
$ php thermage.php
 

Stay RAD!

Stay RAD!

Stay RAD!
Thermage consists of built-in components, called Elements, which can be used individually or together to generate pretty console output.

Theming

<?php

declare(strict_types=1);

use Thermage\Thermage;
use Thermage\Themes\Theme;
use Thermage\Themes\ThemeInterface;
use Atomastic\Arrays\Arrays as Collection;

use function arrays as collection;

final class RadTheme extends Theme implements ThemeInterface
{
  public function getThemeVariables(): Collection
  {
    return collection(['alert' => ['text-align' => 'right']]);
  }
}
<?php

declare(strict_types=1);

use Thermage\Thermage;
use Thermage\Themes\RadTheme;

Thermage::setTheme(new RadTheme());
Thermage provides ability to create and use custom themes to change the style of command line output with preconfigured themes variables.

Shortcodes

[b]Bold text[/b] 
[i]Italic text[/i]
[u]Underilne text[/u]
[s]Strikethrough text[/s]
[color=red]Red text[/color]
[bg=red]Red background[/bg]

and more :)
Thermage provides incredible simple and powerful Shortcodes API to create and use shortcodes markup for customizing CLI output text color, background, formatting.

Framework Agnostic

<?php

use function Thermage\div;
use function Thermage\render;

// ... 

render(
    div('Stay RAD!')
      ->pl5()
      ->colorPink100()
      ->bgPink700()
      ->bold()
      ->italic()
);
<?php

use function Thermage\div;
use function Thermage\renderToString;

// ... 

protected function execute(InputInterface $input, 
                           OutputInterface $output): int
{
  $render = renderToString(div('Stay RAD!')
                            ->pl5()
                            ->colorPink100()
                            ->bgPink700()
                            ->bold()
                            ->italic());

  $output->write($render);
      
  // ...
}
<?php

use function Thermage\div;
use function Thermage\renderToString;

// ... 

public function handle()
{
  $render = renderToString(div('Stay RAD!')
                            ->pl5()
                            ->colorPink100()
                            ->bgPink700()
                            ->bold()
                            ->italic());
                            
  $this->output->writeln($render);
      
  // ...
}
<?php

use function Thermage\div;
use function Thermage\renderToString;

// ... 

public function actionName()
{
  $render = renderToString(div('Stay RAD!')
                            ->pl5()
                            ->colorPink100()
                            ->bgPink700()
                            ->bold()
                            ->italic());
                            
  $this->stdout($render);
      
  // ...
}
<?php

use function Thermage\div;
use function Thermage\renderToString;

// ... 

public function execute(Arguments $args, ConsoleIo $io)
{
  $render = renderToString(div('Stay RAD!')
                            ->pl5()
                            ->colorPink100()
                            ->bgPink700()
                            ->bold()
                            ->italic());
                            
  $io->output($render);
      
  // ...
}
<?php

use function Thermage\div;
use function Thermage\renderToString;

// ... 

public function run(array $params)
{
  $render = renderToString(div('Stay RAD!')
                            ->pl5()
                            ->colorPink100()
                            ->bgPink700()
                            ->bold()
                            ->italic());
                            
  CLI::write($render);
  // ...
}
Thermage can be used with any Modern PHP Framework: Symfony, Laravel, Yii, CakePHP, CodeIgniter, Phalcon and others.