tomkyle / tabulate
Format 2D arrays as CLI console table, Markdown, CSV, YAML, JSON.
1.1.1
2025-06-10 13:54 UTC
Requires
- php: ^8.3
- symfony/console: ^7.3
- symfony/yaml: ^7.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.67
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.0
- rector/rector: ^2.0
- tomkyle/find-run-test: ^1.0
README
Format 2D arrays as CLI tables, Markdown, CSV, YAML, and JSON.
Requirements
- PHP 8.3 or higher
- Symfony Console component for
SymfonyStyleTable
- Symfony Yaml component for
YamlTable
Installation
Install via Composer:
composer require tomkyle/tabulate
Quick Start
composer require tomkyle/tabulate
use tomkyle\Tabulate\TableFactory; $data = [ ['Name' => 'Alice', 'Age' => 30], ['Name' => 'Bob', 'Age' => 25], ]; $factory = new TableFactory(); $factory->fromString('markdown')($data);
Features
- Multiple formats: CLI, Markdown, CSV, YAML, JSON
- Column alignment: Auto-detection and manual override
- Stream output: Direct file writing, memory-efficient processing
- Factory pattern: Dynamic formatter creation for your CLI script with
--format
option support
Documentation
License
MIT License - see LICENSE file.