https://github.com/tomkyle/tabulate
Format 2D arrays as CLI tables, Markdown, CSV, YAML, or JSON
https://github.com/tomkyle/tabulate
Last synced: 5 months ago
JSON representation
Format 2D arrays as CLI tables, Markdown, CSV, YAML, or JSON
- Host: GitHub
- URL: https://github.com/tomkyle/tabulate
- Owner: tomkyle
- License: mit
- Created: 2025-06-10T09:52:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-10T10:48:16.000Z (about 1 year ago)
- Last Synced: 2025-06-10T11:13:50.541Z (about 1 year ago)
- Language: PHP
- Size: 55.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tomkyle/tabulate
[](LICENSE)
[](https://packagist.org/packages/tomkyle/tabulate)
[](https://packagist.org/packages/tomkyle/tabulate)
[](https://github.com/tomkyle/tabulate/actions/workflows/php.yml)
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:
```bash
composer require tomkyle/tabulate
```
## Quick Start
```bash
composer require tomkyle/tabulate
```
```php
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
- [Basic Usage](docs/basic-usage.md)
- [Stream Output](docs/streams.md)
- [Column Alignment](docs/alignment.md)
- [API Reference](docs/api.md)
- [Contributing](docs/contributing.md)
## License
MIT License - see [LICENSE](LICENSE) file.