PHP code example of cfyer / colorize-cli

1. Go to this page and download the library: Download cfyer/colorize-cli 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/ */

    

cfyer / colorize-cli example snippets




fyer\ColorizeCli\CliColor;

echo CliColor::paint('text', 'yellow', 'bg');

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;

echo CliColor::pad("input", 8, '#', 'both') . PHP_EOL;
echo CliColor::bg('blue');
echo CliColor::pad("input", 8, ' ', 'both') . CliColor::RESET;

$mysqli = new mysqli('localhost', 'root', '', 'dbname');
echo CliColor::bold('yellow') . "Connected to {$mysqli->server_info} - ";
echo CliColor::bold('blue') . "{$mysqli->host_info}" . CliColor::RESET;