Skip to content

About

PHPAnsiCode a lib for styling texts in the terminal

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPAnsiCode

PHPAnsiCode is a library so that you can easily apply desired styles to your texts in the terminal.

Installation

composer require php-ansi-code/php-ansi-code

Example

Add Components To Project

require_once 'vendor/autoload.php'; // Original root
require_once '../vendor/autoload.php'; // Example folder root

How To Use

echo Ansi::color('red', 'This is PHPAnsiCode lib');
echo Ansi::red('This is PHPAnsiCode lib');
echo (new Ansi)(['color' => 'red', 'text' => 'This is PHPAnsiCode lib']);
echo (new Ansi)('red', 'This is PHPAnsiCode lib');
echo (new Ansi)->bgGreen('This is PHPAnsiCode lib');
echo Ansi::rgb(rand(0, 255), rand(0, 255), rand(0, 255), 'This is PHPAnsiCode lib');
// open tags
echo Ansi::tagsToColor('Hi my name is <blue>ehsan <reset>');
// open close tags
echo Ansi::tagsToColor('<bgRed>Hi my name is <bgGreen><black>ehsan</black></bgGreen></bgRed>', true);
// Use multiple items at the same time
echo Ansi::bold(Ansi::scColor(rand(0, 255), 'My name is ehsan'));

License

The PHPAnsiCode library has an MIT license. You can read this file LICENSE for more information.

About

PHPAnsiCode a lib for styling texts in the terminal

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages