tdtrung17693 / php-chalk
Just another PHP terminal string styling library
Installs: 249
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/tdtrung17693/php-chalk
Requires
This package is auto-updated.
Last update: 2025-11-20 14:31:03 UTC
README
A PHP terminal styling library inspired by Chalk
Features
- Support 16 colors, 256 colors and Truecolor (16m colors) mode.
- Support style chaining.
- Support style nesting.
Installation
Through composer
composer require tdtrung17693/php-chalk
Manually:
Just download/clone this repo
Usage
See examples to know more about how to use this library.
print $chalk->bold->green("Bold Green"); print "\n"; print $chalk->underscore->color220->bgColor20("Blink Foreground 220 Background 20"); print "\n"; print $chalk->rgb(200, 20, 100)->inverse("Inverse"); // Style nesting print $chalk->red("Red then", $chalk->bold->green("bold and green then"), $chalk->reset("back to normal\n"));
Screenshot:
API
$chalk-><style>[-><style>...](string, [string...])
Example: $chalk->bgGreen->red->bold('Background green red bold text')
$chalk->hasColorSupport(), $chalk->has256Support(), $chalk->has16mSupport()
Return true if the corresponding feature is supported.
Styles supported
reset,bold,dim,underscore,italic,strikethrough,blink.red,green,yellow,blue,magenta,cyan,whitelightGray,darkGray,lightRed,lightGreen,lightYellow,lightBlue,lightMagenta,lightCyan- Each of the color styles above with the prefix
bg
Contribute
Feel free to contribute by forking or making suggestions.

