gamu1012 / cli-text-decoration
String decoration library for PHP CLI output
2.0.0
2026-10-24 14:12 UTC
Requires
- php: ^8.5
Requires (Dev)
- phpunit/phpunit: ^13.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-21 14:44:26 UTC
README
String decoration library for PHP CLI output
Requirements
- PHP 8.5 or later
Installation
composer require gamu1012/cli-text-decoration
Basic Usage
<?php
require __DIR__ . '/vendor/autoload.php';
echo \Gamu1012\CliTextDecoration::setString("RED")->red()->decorate() . "\n";
echo \Gamu1012\CliTextDecoration::setString("MAGENTA-WHITE_BACKGROUND-UNDERLINE")->magenta()->whiteBackground()->underLine()->decorate() . "\n";
To decorate a character string, first set the target string with setString
The setString method returns a CliTextDecoration instance
Use this to connect chain of decoration information.
Finally, we use the decorate method to get the result
Method List
Front Color
- black()
- red()
- green()
- yellow()
- blue()
- magenta()
- cyan()
- white()
Background Color
- blackBackground()
- redBackground()
- greenBackground()
- yellowBackground()
- blueBackground()
- magentaBackground()
- cyanBackground()
- whiteBackground()
Attribute
- bold()
- italic()
- underLine()
- blink()
- reverse()
- hidden()
