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 termage/termage

Features

> Consistent Colors

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

> Component System

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


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

Stay RAD!

Stay RAD!

Stay RAD!

Stay RAD!
Terminal
$ php termage.php
 

Stay RAD!

Stay RAD!

Stay RAD!
Termage 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 Termage\Termage;
use Termage\Themes\Theme;
use Termage\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 Termage\Termage;
use Termage\Themes\RadTheme;

Termage::setTheme(new RadTheme());
Termage 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 :)
Termage 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 Termage\div;

// ... 

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

use function Termage\div;

// ... 

protected function execute(InputInterface $input, 
                           OutputInterface $output): int
{
  $output->write(
      div('Stay RAD!')
        ->pl5()
        ->colorPink100()
        ->bgPink700()
        ->bold()
        ->italic()
  );
      
  // ...
}
<?php

use function Termage\div;

// ... 

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

use function Termage\div;

// ... 

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

use function Termage\div;

// ... 

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

use function Termage\div;

// ... 

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