snufkin/console-table

A table generator class for the PHP CLI.

1.0 2013-04-22 05:13 UTC

This package is not auto-updated.

Last update: 2025-05-16 22:06:47 UTC


README

  1. Install composer
  2. Run composer require snufkin/ConsoleTable
  3. Profit!

Usage

$table = new \Console\Helper\ConsoleTable();
$table->setHeaders(['Column 1', 'Column 2']);
$table->addRow(['data 1', 'data 2']);
$table->addRow(['data 3', 'data 4']);
$table->addRow(['data 5', 'data 6']);
echo $table->getTable();

Customisations

By default all columns are aligned left. To change the alignment use the 0 as the first parameter in the constructor:

$table = new \Console\Helper\ConsoleTable(0);