jakub-onderka/php-console-color
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Jakub-onderka/php-console-color is a streamlined PHP library designed to create colored console output. This powerful tool is particularly helpful when you want to enhance the readability of your console information by implementing color-coding strategies.
Using Jakub-onderka/php-console-color is an effortless task. To start with, include the package in your PHP file using Composer's autoloading feature. The console output color can be set by instantiating the ConsoleColor
class and using the addStyle
method to define custom styles.
Here's a basic example of how you can use php-console-color
:
require 'vendor/autoload.php';
use JakubOnderka\PhpConsoleColor\ConsoleColor;
$consoleColor = new ConsoleColor();
echo $consoleColor->apply('green', 'Hello world!');
In the above coding snippet, the output 'Hello world!' will appear in green color on the console.
And if you want to add custom styles :
$consoleColor = new ConsoleColor();
$consoleColor->addStyle('blink', ['underscore', 'yellow', 'bg_red']);
echo $consoleColor->apply('blink, underscore', 'Hello world!');
In this case, the output 'Hello world!' will appear as underscored yellow text on a red background and will blink.
Please remember blink
may not work in all terminal emulators.
As for documentation on jakub-onderka/php-console-color, you can refer to the example.php
file in the package's root directory on GitHub. The example file serves as practical and efficient documentation, demonstrating how to use this library effectively.