PHPackages                             unmainsys/array-to-text-table - 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. unmainsys/array-to-text-table

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

unmainsys/array-to-text-table
=============================

Display arrays in terminal

1.0.3(2y ago)098PHPPHP &gt;=8.0.0

Since Mar 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/unmainsys/array-to-text-table)[ Packagist](https://packagist.org/packages/unmainsys/array-to-text-table)[ RSS](/packages/unmainsys-array-to-text-table/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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

[](#arraytotexttable)

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

[](#installation)

```
composer require unmainsys/array-to-text-table

```

```
{
    "require": {
        "unmainsys/array-to-text-table": "1.0.3"
    }
}
```

Example
-------

[](#example)

```
use Unmainsys\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 \Unmainsys\Table\Decorator\Ascii());
// Unicode (default), Ascii

$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

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

785d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d8701199819c72c075ae0248e9b43157bc3d625ed073daf0943249ff4390d83?d=identicon)[unmainsys](/maintainers/unmainsys)

---

Tags

terminalarrayunicodetextasciitable

### Embed Badge

![Health badge](/badges/unmainsys-array-to-text-table/health.svg)

```
[![Health](https://phpackages.com/badges/unmainsys-array-to-text-table/health.svg)](https://phpackages.com/packages/unmainsys-array-to-text-table)
```

###  Alternatives

[mathieuviossat/arraytotexttable

Display arrays in terminal

777.4M5](/packages/mathieuviossat-arraytotexttable)[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.2k](/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.0M272](/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)

PHPackages © 2026

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