antibiotics11 / ansi-styler
Utility for applying ANSI colors and text styles to console output.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/antibiotics11/ansi-styler
README
A PHP utility for applying ANSI colors and text styles to console output.
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();
Requirements
- PHP >= 8.1
Installation
composer require antibiotics11/ansi-styler