PHPackages                             doghouse-agency/php-table-multiformat - 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. doghouse-agency/php-table-multiformat

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

doghouse-agency/php-table-multiformat
=====================================

Table output for PHP scripts (CLI, CSV, etc)

v2.0.0(2y ago)421BSD-1-ClausePHPPHP &gt;=5.3.0

Since Oct 9Pushed 1y agoCompare

[ Source](https://github.com/DoghouseMedia/php-table-multiformat)[ Packagist](https://packagist.org/packages/doghouse-agency/php-table-multiformat)[ Docs](https://github.com/jc21/clitable)[ RSS](/packages/doghouse-agency-php-table-multiformat/feed)WikiDiscussions main Synced 2d ago

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

Table Handling for PHP
======================

[](#table-handling-for-php)

[![Example](example.png)](example.png)

- Nice table output of data rows
- Columns adjust to data size
- Data manipulators for fields, formats raw data to a nice display output
- Colors! When specifying a color, choose from these strings: blue, red, green, yellow, black, magenta, cyan, white, grey
- Support for multi-line values.

### Installing via Composer

[](#installing-via-composer)

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version:

```
composer.phar require tnelson-doghouse/php-table
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

### Using

[](#using)

[Class documentation](docs/Documentation.md)

See the tests folder for some examples, but basically here's how to use it:

```
use \PHPTable\Format\HumanOnly;

// $data used below is an array of rows with fields. See tests/data.php for an example.

$tablemaker = new \PHPTable\Factory();
$table = $tablemaker->make('human-only');
$table->setTableColor('blue');
$table->setHeaderColor('cyan');
$table->addField('First Name', 'firstName',    false,                               'white');
$table->addField('Last Name',  'lastName',     false,                               'white');
$table->addField('DOB',        'dobTime',      new \PHPTable\Manipulator\Base('datelong'));
$table->addField('Admin',      'isAdmin',      new \PHPTable\Manipulator\Base('yesno'),    'yellow');
$table->addField('Last Seen',  'lastSeenTime', new \PHPTable\Manipulator\Base('nicetime'), 'red');
$table->addField('Expires',    'expires',      new \PHPTable\Manipulator\Base('duetime'),  'green');
$table->injectData($data);
$table->display();
```

### Manipulators

[](#manipulators)

These are the manipulators provided in the package:

- dollar: Formats 12300.23 to $12,300.23
- date: Formats unix timestamp 1372132121 to AU date 25-06-2013 (because I'm an Aussie mate)
- datelong: Formats unix timestamp 1372132121 to 25th June 2013
- time: Formats unix timestamp 1372132121 to 1:48 pm
- datetime: Formats unix timestamp 1372132121 to 25th June 2013, 1:48 pm
- nicetime: Formats unix timestamp 1372132121 to one of the following, depending if it falls on Today or Yesterday or earlier:
    - Today, 1:48 pm
    - Yesterday, 1:48 pm
    - 25th June 2013, 1:48 pm
- duetime: Formats unix timestamp to x years x days x hours x minutes x seconds
- nicenumber: Formats 123456 to 123,456
- month: Formats unix timestamp 1372132121 to June
- year: Formats unix timestamp 1372132121 to 2013
- monthyear: Formats unix timestamp 1372132121 to June 2013
- percent: Formats 54 to 54%
- yesno: Formats a boolean value to Yes or No
- text: Strips HTML from the value before returning

If you want to create your own manipulators:

```
class MyManipulator extends \PHPTable\Manipulator\Base {
	public function chucknorris($value)
	{
		return 'Chuck norris said: ' . $value;
	}
}

$tablemaker = new \PHPTable\Factory();
$table = $tablemaker->make('human-only');
$table->setTableColor('blue');
$table->setHeaderColor('cyan');
$table->addField('First Name', 'firstName',    false,                               'white');
$table->addField('Last Name',  'lastName',     false,                               'white');
$table->addField('DOB',        'dobTime',      new \PHPTable\Manipulator\Base('datelong'));
$table->addField('Admin',      'isAdmin',      new MyManipulator('chucknorris'),    'yellow');
$table->addField('Last Seen',  'lastSeenTime', new \PHPTable\Manipulator\Base('nicetime'), 'red');
$table->addField('Expires',    'expires',      new \PHPTable\Manipulator\Base('duetime'),  'green');
$table->injectData($data);
$table->display();
```

#### Manipulator\\TextWidth

[](#manipulatortextwidth)

This manipulator allows for fixed-width columns; it can clip or wrap, as desired.

```
$wrapper = new \PHPTable\Manipulator\TextWidth(
	max_width: 30,
	wrapping: 'clip',
);
```

### Formats

[](#formats)

Currently supported formats are:

- human-only (HumanOnly): Pretty, aesthetically pleasing, but not machine readable; uses ANSI Escape sequences for colour, etc
- half-human (HalfHuman): Like a Unix command; in a table, but should be somewhat machine readable (specifically, columns split on space should work). Not well done yet, but works in some cases
- csv (CSVTable): Outputs to a CSV file

The advantage of using the Factory is that the format can then be eg. a string passed on the command line, so that people can choose to have their report in eg. human-readable or CSV.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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

1000d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01581490e4f6d0a4861f5e0f3037be8ce646abeb4a725472fc40afd9e6b3fac9?d=identicon)[doghouseagency](/maintainers/doghouseagency)

---

Top Contributors

[![tnelson-doghouse](https://avatars.githubusercontent.com/u/46908365?v=4)](https://github.com/tnelson-doghouse "tnelson-doghouse (15 commits)")[![jc21](https://avatars.githubusercontent.com/u/1518257?v=4)](https://github.com/jc21 "jc21 (10 commits)")[![biggianteye](https://avatars.githubusercontent.com/u/1482649?v=4)](https://github.com/biggianteye "biggianteye (6 commits)")[![conrad10781](https://avatars.githubusercontent.com/u/238705?v=4)](https://github.com/conrad10781 "conrad10781 (2 commits)")[![jiangbianwanghai](https://avatars.githubusercontent.com/u/1704740?v=4)](https://github.com/jiangbianwanghai "jiangbianwanghai (1 commits)")

---

Tags

clicommandtableline

### Embed Badge

![Health badge](/badges/doghouse-agency-php-table-multiformat/health.svg)

```
[![Health](https://phpackages.com/badges/doghouse-agency-php-table-multiformat/health.svg)](https://phpackages.com/packages/doghouse-agency-php-table-multiformat)
```

###  Alternatives

[league/climate

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

1.9k14.7M300](/packages/league-climate)[nategood/commando

PHP CLI Commando Style

8123.4M40](/packages/nategood-commando)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2959.5M256](/packages/helhum-typo3-console)[adhocore/cli

Command line interface library for PHP

3511.4M59](/packages/adhocore-cli)[aplus/cli

Aplus Framework CLI Library

2311.7M6](/packages/aplus-cli)[phalcon/cli-options-parser

Command line arguments/options parser.

181.1M10](/packages/phalcon-cli-options-parser)

PHPackages © 2026

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