Download the PHP package weew/console-formatter without Composer
On this page you can find all versions of the php package weew/console-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download weew/console-formatter
More information about weew/console-formatter
Files in weew/console-formatter
Package console-formatter
Short Description Formatter for command line output.
License MIT
Informations about the package console-formatter
Output Formatter for command line
Table of contents
Installation
composer require weew/console-formatter
Introduction
This package allows you to format text for terminal, using very simple and html like syntax. You will be able to change text color, text background and text format.
This package has not been tested on windows and I do not intend to do so. Contributions for windows support are highly appreciated.
Adding styles
Before you'll be able to use styles, you must created them first.
Using styles
As soon as you've register a style, it will be applied to matching tags. If a style is unknown, the tag will be ignored. Example below will output properly formatted text.
Using inline styles
You can apply styling inline, without having to register a new style. To do that you must use the <style></style>
tag.
You can also use inline styling on predefined styles.
Style isolation
Whenever you have nested styles, one style might inherit from the parent. This is disabled by default to prevent unwanted styles changes. You can enable it for each style separately.
Disabling ANSI
If you're working with a terminal that does not support ANSI, you can disable formatting. All known style tags will be removed from the string.
Examples
You can run the examples.php
file to see if it works on your system.