mmarica / display-table
Display tables in text format
Installs: 51 521
Dependents: 3
Suggesters: 0
Security: 0
Stars: 9
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.0
Requires (Dev)
- phpunit/phpunit: ~4.0|~5.0
README
+=========+========+=======+=========+
| Console | Tables | Made | Easy |
+=========+========+=======+=========+
Display tables
A simple PHP Library for generating tables in text format, useful for writing summaries in log or console.
Table of Contents
Installation
The easiest way to install is via composer:
$ composer require mmarica/display-table
Requirements
The following versions of PHP are supported:
- PHP 5.6
- PHP 7.0
- PHP 7.1
Documentation
Example
Printing a text table is as simple as this:
<?php require_once dirname(__FILE__) . '/vendor/autoload.php'; use Mmarica\DisplayTable; print DisplayTable::create() ->headerRow(['#', 'Person', 'Hobbies']) ->dataRows([ ['1', 'Mihai', 'Cycling, Gaming, Programming'], ['2', 'Chewbacca', 'Growling, hibernating'], ['3', 'Philip J. Fry', 'Time traveling, eating anchovies'], ]) ->toText()->generate();
.---.---------------.----------------------------------.
| # | Person | Hobbies |
:---+---------------+----------------------------------:
| 1 | Mihai | Cycling, Gaming, Programming |
| 2 | Chewbacca | Growling, hibernating |
| 3 | Philip J. Fry | Time traveling, eating anchovies |
'---'---------------'----------------------------------'