PHPackages                             brano/format-output - 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. brano/format-output

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

brano/format-output
===================

Format console text output

010PHP

Since Nov 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Netlic/output-formatter)[ Packagist](https://packagist.org/packages/brano/format-output)[ RSS](/packages/brano-format-output/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Output Formatter
================

[](#output-formatter)

Console output simplified.

Requirements
------------

[](#requirements)

- PHP 7.4

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

[](#installation)

Configuration
-------------

[](#configuration)

Please take a look at a [configuration file.](/config/config.php). Any configuration value can be accessed via `config`helper function, e.g.:

```
$translationFormats = config('translation-formats');

/* For accessing nested values '.' character can be used,
following will return foreground red color code */
$redColorCode = config('translation-formats.colors.red');
```

Every configuration value can be overriden by creating array using the same keys as used in the original config file and passing it as a parameter when initializing library. For example:

```
use OutputFormat\Outputter;

$myConfigArray = ['translation-formats' => [
    'colors' => [
        'red' => '15'
    ]
]];

$outputter = Outputter::init($myConfigArray);
```

Usage
-----

[](#usage)

#### Initialize the library

[](#initialize-the-library)

```
use OutputFormat\Outputter;

//throws an exception
$outputter = Outputter::init();
```

#### Add formatting

[](#add-formatting)

```
//changes foreground color
/** @var OutputFormat\Outputter $outputter*/
$outputter->color('red');

//using multiple formatters is also available by chaining
$outputter->color('red')->lowercase()->backgroundColor('yellow');

//library also supports 88/256 coloring,
//for this case just pass a number of color instead of its name
$outputter->color('50')->backgroundColor('200');
```

#### Print output

[](#print-output)

```
/** For printing output the config value 'output'
 class is instantiated and invoked */

/** @var OutputFormat\Outputter $outputter */
$outputter->print('Lorem ipsum');

//prints line
$outputter->printLine('Lorem ipsum');

//text formatting can by applied also on printing
$outputter->printLine('Lorem ipsum', ['color:yellow', 'lowercase']);

//to preserve formatting just set the last parameter to true
$outputter->printLine('Lorem ipsum', ['color:yellow', 'lowercase'], true);
```

#### Current formatter list

[](#current-formatter-list)

```
use OutputFormat\Outputter;

/**
 * @method Outputter color(string $color)
 * @method Outputter backgroundColor(string $color)
 * @method Outputter lowercase()
 * @method Outputter capitalizeWords()
 * @method Outputter textFeature(string $feature)
 */

/* Print method accepts referencing to formatter in kebab-case
 eg. 'capitalize-words'
```

#### Modifying formatters

[](#modifying-formatters)

Any formatter can be easily replaced by your custom class. Simply rewrite class reference under the desired config key [as suggested above](#configuration). This way you can also extend the list of existing formatters. A good practice after doing so would be extending the base class `OutputFormat\OutputFormat` and update the PHP doc of the class.

[Source of knowledge](https://misc.flogisoft.com/bash/tip_colors_and_formatting)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12696225?v=4)[Netlic](/maintainers/Netlic)[@Netlic](https://github.com/Netlic)

---

Top Contributors

[![Netlic](https://avatars.githubusercontent.com/u/12696225?v=4)](https://github.com/Netlic "Netlic (33 commits)")

### Embed Badge

![Health badge](/badges/brano-format-output/health.svg)

```
[![Health](https://phpackages.com/badges/brano-format-output/health.svg)](https://phpackages.com/packages/brano-format-output)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[tomatophp/filament-artisan

Simple but yet powerful library for running some artisan commands for FilamentPHP

3275.4k1](/packages/tomatophp-filament-artisan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
