1. Go to this page and download the library: Download travail/term-ansicolor 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/ */
travail / term-ansicolor example snippets
use \Term\ANSIColor;
ing
echo ANSIColor::colored("Yellow text\n", 'yellow');
echo ANSIColor::colored("Normal text on magenta\n", null, 'magenta');
echo ANSIColor::colored("Underscored text\n", null, null, 'underscore');
echo ANSIColor::colored("Red on cyan\n", 'red', 'cyan');
echo ANSIColor::colored("Blinking blue text on light gray\n", 'blue', 'light_gray', 'blink');
// Get a colored string by an alias
ANSIColor::setAlias('debug', 'red', 'light_gray');
echo ANSIColor::colored("[DEBUG] Debug message in red on light_gray\n" , 'debug');
ANSIColor::setAlias('error', 'red', 'black');
echo ANSIColor::colored("[ERROR] Error message in red on black\n" , 'error');