fgendorf / php-array-table
PHP Library for printing associative arrays as text table (similar to mysql terminal console) with compatibility with markdown
v1.0.1
2022-08-17 16:28 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2025-04-11 03:07:37 UTC
README
PHP-class, which allows to transform php associative arrays to cool ASCII tables.
Installation
Simply run composer require:
composer require fgendorf/php-array-table
or add to composer.json:
"fgendorf/php-array-table": "1.0"
Usage
<?php use dekor\ArrayToTextTable; $data = [ [ 'id' => 1, 'name' => 'Denis Koronets', 'role' => 'php developer', ], [ 'id' => 2, 'name' => 'Maxim Ambroskin', 'role' => 'java developer', ], [ 'id' => 3, 'name' => 'Andrew Sikorsky', 'role' => 'php developer', ] ]; echo (new ArrayToTextTable($data))->render();
Will draw the next output, compliance with markdown:
| id | name | role | |----|-----------------|----------------| | 1 | Denis Koronets | php developer | | 2 | Maxim Ambroskin | java developer | | 3 | Andrew Sikorsky | php developer |
Made with ❤ by denis