PHPackages                             psdi/motif - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. psdi/motif

ActiveLibrary[CLI &amp; Console](/categories/cli)

psdi/motif
==========

PHP CLI output formatter

v1.0(6y ago)06PHPPHP ^7.0CI failing

Since Mar 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/psdi/motif)[ Packagist](https://packagist.org/packages/psdi/motif)[ RSS](/packages/psdi-motif/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Motif
=====

[](#motif)

A simple PHP tool for formatting output text on a terminal.

Installation
------------

[](#installation)

Install using composer:

```
composer require psdi/motif [--no-dev]

```

> Include the flag `--no-dev` if you want to omit installing PHPUnit (which isn't exactly a lightweight framework).

Usage
-----

[](#usage)

The `Formatter` class has three main output functions:

- `format` takes a string as well as a style string

> The style string has the following syntax: `[format,styles]|color:[color]|bg:[background]`. The order of the styles doesn't matter; you can even omit them.

- `formatLine` expands on `format`; however, it appends a line break to the text
- `display` accepts a text as well as a mode (success, warning, error, info). The function prints the text with the corresponding background color (green, yellow, red, blue).

```
