PHPackages                             jc21/clitable - 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. jc21/clitable

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

jc21/clitable
=============

CLI Table output for PHP scripts

1.3(2y ago)61278.3k—9.9%20[2 issues](https://github.com/jc21/clitable/issues)4BSD-1-ClausePHPPHP &gt;=5.3.0

Since Apr 15Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (1)Versions (5)Used By (4)

CLI Table Output for PHP
========================

[](#cli-table-output-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 jc21/clitable
```

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 jc21\CliTable;

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

$table = new CliTable;
$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 CliTableManipulator('datelong'));
$table->addField('Admin',      'isAdmin',      new CliTableManipulator('yesno'),    'yellow');
$table->addField('Last Seen',  'lastSeenTime', new CliTableManipulator('nicetime'), 'red');
$table->addField('Expires',    'expires',      new CliTableManipulator('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 CliTableManipulator {
	public function chucknorris($value)
	{
		return 'Chuck norris said: ' . $value;
	}
}

$table = new CliTable;
$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 CliTableManipulator('datelong'));
$table->addField('Admin',      'isAdmin',      new MyManipulator('chucknorris'),    'yellow');
$table->addField('Last Seen',  'lastSeenTime', new CliTableManipulator('nicetime'), 'red');
$table->addField('Expires',    'expires',      new CliTableManipulator('duetime'),  'green');
$table->injectData($data);
$table->display();
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 52.6% 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 ~1032 days

Total

4

Last Release

953d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac74f1d8680bf428354d9454f004220bbfffc3ff598333ff89777451887e9e12?d=identicon)[jc21](/maintainers/jc21)

---

Top Contributors

[![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/jc21-clitable/health.svg)

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

###  Alternatives

[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)[nategood/commando

PHP CLI Commando Style

8123.3M38](/packages/nategood-commando)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2939.0M192](/packages/helhum-typo3-console)[adhocore/cli

Command line interface library for PHP

3501.2M50](/packages/adhocore-cli)[aplus/cli

Aplus Framework CLI Library

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

Command line arguments/options parser.

181.0M7](/packages/phalcon-cli-options-parser)

PHPackages © 2026

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