PHP code example of antibiotics11 / ansi-styler
1. Go to this page and download the library: Download antibiotics11/ansi-styler 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/ */
antibiotics11 / ansi-styler example snippets
use antibiotics11\AnsiStyler\{AnsiColorCode, AnsiFormatter};
// create a new AnsiFormatter instance
$styler = new AnsiFormatter();
// apply yellow background color, red foreground color and bold style
$formattedText = $styler->withBackgroundColor(AnsiColorCode::BACKGROUND_YELLOW)
->withForegroundColor(AnsiColorCode::FOREGROUND_RED)
->withBold()
->format("Hello, World!");
printf("%s\r\n", $formattedText);
// reinitialize the AnsiFormatter
$styler->initialize();