composer require cfyer/colorize-cli
<?php
require './vendor/autoload.php';
use Cfyer\ColorizeCli\CliColor;
echo CliColor::paint('text', 'yellow', 'bg');
or
echo CliColor::fg('red') . "Hello" . CliColor::RESET . PHP_EOL;
echo CliColor::bg('red') . "Hello" . CliColor::RESET . PHP_EOL;
echo CliColor::ul('red') . "Hello" . CliColor::RESET . PHP_EOL;
echo CliColor::bold('red') . "Hello" . CliColor::RESET . PHP_EOL;
- background : bg
- foreground : fg
- underline : ul
- bold : bold
- black
- red
- green
- yellow
- blue
- purple
- cyan
- white
echo CliColor::pad("input", 8, '#', 'both') . PHP_EOL;
echo CliColor::bg('blue');
echo CliColor::pad("input", 8, ' ', 'both') . CliColor::RESET;
- left
- right
- both
$mysqli = new mysqli('localhost', 'root', '', 'dbname');
echo CliColor::bold('yellow') . "Connected to {$mysqli->server_info} - ";
echo CliColor::bold('blue') . "{$mysqli->host_info}" . CliColor::RESET;
The MIT License (MIT). See License File for more information.