PHPackages                             mathieuviossat/arraytotexttable - 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. mathieuviossat/arraytotexttable

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

mathieuviossat/arraytotexttable
===============================

Display arrays in terminal

v1.0.11(2y ago)777.4M—1.2%18[1 issues](https://github.com/viossat/arraytotexttable/issues)4MITPHPPHP &gt;=8.0.0

Since Jul 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/viossat/arraytotexttable)[ Packagist](https://packagist.org/packages/mathieuviossat/arraytotexttable)[ Docs](https://github.com/viossat/arraytotexttable)[ RSS](/packages/mathieuviossat-arraytotexttable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (4)

ArrayToTextTable
================

[](#arraytotexttable)

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

[](#installation)

```
composer require mathieuviossat/arraytotexttable

```

```
{
    "require": {
        "mathieuviossat/arraytotexttable": "~1.0.0"
    }
}
```

Example
-------

[](#example)

```
use MathieuViossat\Util\ArrayToTextTable;

$data = [
    [
        'firstname' => 'Mollie',
        'surname' => 'Alvarez',
        'email' => 'molliealvarez@example.com',
    ],
    [
        'firstname' => 'Dianna',
        'surname' => 'Mcbride',
        'age' => 43,
        'email' => 'diannamcbride@example.com',
    ],
    [
        'firstname' => 'Elvira',
        'surname' => 'Mueller',
        'age' => 50,
        'email' => 'elviramueller@example.com',
    ],
    [
        'firstname' => 'Corine',
        'surname' => 'Morton',
        'age' => 35,
    ],
    [
        'firstname' => 'James',
        'surname' => 'Allison',
    ],
    [
        'firstname' => 'Bowen',
        'surname' => 'Kelley',
        'age' => 50,
        'email' => 'bowenkelley@example.com',
    ],
];

$renderer = new ArrayToTextTable($data);
echo $renderer->getTable();
```

Result
------

[](#result)

```
┌───────────┬─────────┬───────────────────────────┬─────┐
│ FIRSTNAME │ SURNAME │           EMAIL           │ AGE │
├───────────┼─────────┼───────────────────────────┼─────┤
│ Mollie    │ Alvarez │ molliealvarez@example.com │     │
│ Dianna    │ Mcbride │ diannamcbride@example.com │ 43  │
│ Elvira    │ Mueller │ elviramueller@example.com │ 50  │
│ Corine    │ Morton  │                           │ 35  │
│ James     │ Allison │                           │     │
│ Bowen     │ Kelley  │ bowenkelley@example.com   │ 50  │
└───────────┴─────────┴───────────────────────────┴─────┘

```

Options
-------

[](#options)

```
$renderer->setData($newData);
// Accepts array of arrays and array of objects.
// Can also be called through getTable():
$renderer = new ArrayToTextTable();
echo $renderer->getTable($data);

$renderer->setDecorator(new \Zend\Text\Table\Decorator\Ascii());
// Unicode (default), Ascii, Blank

$renderer->setIndentation("\t");
// default: *empty string*

$renderer->setDisplayKeys(false);
// true, false, 'auto' (default, doesn't display keys if all of them are integers)

$renderer->setUpperKeys(false);
// default: true

$renderer->setKeysAlignment(ArrayToTextTable::AlignCenter);
// AlignLeft, AlignCenter (default), AlignRight

$renderer->setValuesAlignment(ArrayToTextTable::AlignLeft);
// AlignLeft (default), AlignCenter, AlignRight

$formatter = function(&$value, $key, $renderer) {
    if ($value === true)
        $value = 'TRUE';
    else if ($value === false)
        $value = 'FALSE';
    else if ($value === '')
        $value = 'EMPTY';
    else if ($value === null)
        $value = 'NULL';
};
$renderer->setFormatter($formatter);
// default: null
```

License
-------

[](#license)

This library is published under [The MIT License](http://opensource.org/licenses/MIT).

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity58

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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.

###  Release Activity

Cadence

Every ~286 days

Recently: every ~434 days

Total

12

Last Release

825d ago

PHP version history (3 changes)v1.0.0PHP &gt;=5.3.0

v1.0.10PHP ~8.0.0 || ~8.1.0 || ~8.2.0

v1.0.11PHP &gt;=8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cb1917505dcd11c319b7407cdafed34d41509b57fd8fd6a3be528d86cb96d14?d=identicon)[viossat](/maintainers/viossat)

---

Top Contributors

[![viossat](https://avatars.githubusercontent.com/u/3019820?v=4)](https://github.com/viossat "viossat (21 commits)")[![fadonascimento](https://avatars.githubusercontent.com/u/1638439?v=4)](https://github.com/fadonascimento "fadonascimento (1 commits)")[![FlorentTorregrosa](https://avatars.githubusercontent.com/u/1962368?v=4)](https://github.com/FlorentTorregrosa "FlorentTorregrosa (1 commits)")

---

Tags

terminalarrayunicodetextasciitable

### Embed Badge

![Health badge](/badges/mathieuviossat-arraytotexttable/health.svg)

```
[![Health](https://phpackages.com/badges/mathieuviossat-arraytotexttable/health.svg)](https://phpackages.com/packages/mathieuviossat-arraytotexttable)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.0M273](/packages/league-climate)[clue/term-react

Streaming terminal emulator, built on top of ReactPHP.

10410.2M2](/packages/clue-term-react)[php-school/cli-menu

A command line menu helper in PHP

2.0k1.1M27](/packages/php-school-cli-menu)[recca0120/terminal

run laravel artisan command in web application

878410.9k2](/packages/recca0120-terminal)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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