Download the PHP package dekor/php-array-table without Composer
On this page you can find all versions of the php package dekor/php-array-table. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-array-table
PHP Array To Text Table
PHP-class, which allows to transform php associative arrays to cool ASCII tables.
Quick doc:
https://deniskoronets.github.io/php-array-table/
Installation
Simply run composer require:
composer require dekor/php-array-table
or add to composer.json:
"dekor/php-array-table": "^2.0"
Usage
Will draw the next output:
+----+-----------------+----------------+ | id | name | role | +----+-----------------+----------------+ | 1 | Denis Koronets | php developer | | 2 | Maxim Ambroskin | java developer | | 3 | Andrew Sikorsky | php developer | +----+-----------------+----------------+
Formatters (since v2)
Version 2 introduces a new feature that allows to pre and postprocess column data by applying filters.
You're able to develop your own formatters by extending BaseColumnFormatter
and implementing abstract methods.
List of formatters out of the box:
AlignFormatter
- allows to set text align for inner column (useful for numbers):
outputs:
+------+------------------------------------------+-------+ | left | center | right | +------+------------------------------------------+-------+ | 2 | Dummy one | 14.33 | | 3 | Another great day for a great inventers! | 1 | +------+------------------------------------------+-------+
SprintfFormatter
- allows to format column value before rendering using sprintf function (ex: %01.3f)
outputs:
+-------+-------+ | left | right | +-------+-------+ | 1.000 | 2.890 | +-------+-------+
ColorFormatter
- allows to highlight text with specific color (only works in terminal):
outputs:
Allowed colors list (see ColorFormatter::$colors
)
- Black
- Dark Grey
- Red
- Light Red
- Green
- Light Green
- Brown
- Yellow
- Blue
- Light Blue
- Magenta
- Light Magenta
- Cyan
- Light Cyan
- Light Grey
- White
Our sponsors list:
All versions of php-array-table with dependencies
ext-mbstring Version *