Download the PHP package simoneast/simple-ansi-colors without Composer
On this page you can find all versions of the php package simoneast/simple-ansi-colors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download simoneast/simple-ansi-colors
More information about simoneast/simple-ansi-colors
Files in simoneast/simple-ansi-colors
Package simple-ansi-colors
Short Description Simple PHP class for converting basic HTML-like color tags into ANSI escape codes for use in console apps and scripts. Auto-detection for Windows/Ansicon users included.
License MIT
Homepage https://github.com/SimonEast/Simple-Ansi-Colors
Informations about the package simple-ansi-colors
Simple ANSI Colors in PHP
Simple PHP class for converting basic HTML-like color tags into ANSI escape codes for use in console apps and scripts.
Can be disabled through a single variable so that no colors are output (such as if the output needs to be piped to another app or script).
Auto-detection for Windows/ANSICON users included. Colors are disabled by default on Windows unless ANSICON is detected.
Version 1.0.1
MIT Licence
Requires PHP 5.3 or above.
How to use
- Include the class in your script:
require('simple-ansi-colors.php');
- Output some text:
echo Ansi::tagsToColors('<green>Hello <yellow>World!');
Note that unlike HTML, there are no closing tags. Simply use <reset>
to return the color to the default. For example...
Supported tags
Run php demo.php
to view a sample of all the options available. In consoles with ANSI color support, you'll see the following...
In the Windows command prompt (without ANSICON), color tags will simply be stripped out.
Windows users can download ANSICON and install it by running ansicon -i
from a command prompt or "Run" window. This will allow them to view colors.