PHP code example of abcarroll / simple-ansi-escape
1. Go to this page and download the library: Download abcarroll/simple-ansi-escape 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/ */
abcarroll / simple-ansi-escape example snippets
use SimpleAnsiEscape\SimpleAnsiEscape as esc;
echo esc::ansiEscape('color/yellow, blink', "I hope you enjoy Simple-Ansi-Escape!");
// In the array form, one-parameter syntax:
echo esc::ansiEscape(array('color/blue', 'faint', 'underline')), "I hope you enjoy Simple-Ansi-Escape!");
// The same thing, as a string:
echo esc::ansiEscape('color/blue, faint, underline', "I hope you enjoy Simple-Ansi-Escape!");
// You can use commas, spaces, or semi-colons as well. Although it looks poor, even
// mixing and matching will not confuse Simple-Ansi-Escape:
echo esc::ansiEscape('color/red faint; underline, bold', "I hope you enjoy Simple-Ansi-Escape!");
// This is INCORRECT. The inner escape will terminate formatting and ' properly' will be
// in the default terminal style.
echo esc::ansiEscape(
'text/green',
"This is NOT how you " . esc::ansiEscape('bold', 'nest') . " properly!"
);
// This is CORRECT. We're build the value in the proper linear order:
echo esc::ansiEscape('text/green') . "This is how you ". esc::ansiEscape('bold')
. "properly " . esc::ansiEscape('~bold') . "next formatting." . esc::ansiEscape();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.