mdurrant / php-console-color
Extremely simple library for writing to the console in color
Installs: 1 603
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2025-03-05 09:04:35 UTC
README
####Purpose This lightweight library only serves to make formatted console output code more readable.
Instead of:
echo "\033[0;31Foo:\033[0m Bar";
We can do:
$console->writeLn("<red>Foo:</red> Bar");
####Usage
$console = new Console(); $console->write('This'); $console->write('is'); $console->write('a'); $console->writeLn('<blue>Test</blue>'); $console->writeLn('Hello world!');
will output
####Colors
Color Code | Info |
---|---|
black | Black |
red | Red |
green | Green |
yellow | Yellow |
blue | Blue |
purple | Purple |
cyan | Cyan |
white | White |
blackB | Black Bold |
redB | Red Bold |
greenB | Black Bold |
yellowB | Yellow Bold |
blueB | Blue Bold |
purpleB | Purple Bold |
cyanB | Cyan Bold |
whiteB | White Bold |
blackU | Black Underlined |
redU | Red Underlined |
greenU | Black Underlined |
yellowU | Yellow Underlined |
blueU | Blue Underlined |
purpleU | Purple Underlined |
cyanU | Cyan Underlined |
whiteU | White Underlined |
####License MIT