marcin-orlowski/text-table

Fast and flexible PHP library for text tables.

2.8.0 2023-10-30 12:42 UTC

This package is auto-updated.

Last update: 2024-11-30 02:34:33 UTC


README

..######.#####.##...##.######...######...#....#####..##....#####..
....##...##.....##.##....##.......##....###...##..##.##....##.....
....##...##......###.....##.......##...##.##..##..##.##....##.....
....##...####.....#......##.......##..##...##.#####..##....####...
....##...##......###.....##.......##..#######.##..##.##....##.....
....##...##.....##.##....##.......##..##...##.##..##.##....##.....
....##...#####.##...##...##.......##..##...##.#####..#####.#####..

Fast and flexible PHP library for text tables.

Latest Stable Version Total Downloads License PHP Version Require

There's also a Python version of this library.

Features

  1. Production ready,
  2. Easy to use,
  3. No additional dependencies,
  4. Documented.

Usage examples

$table = new TextTable(['ID', 'NAME', 'SCORE']);
$table->addRows([
    [1, 'John', 12],
    [2, 'Tommy', 15],
]);
echo $table->renderAsString();

would produce nice text table:

┌────┬───────┬───────┐
│ IDNAMESCORE │
├────┼───────┼───────┤
│ 1John12    │
│ 2Tommy15    │
└────┴───────┴───────┘

Check docs for more usage examples.

License

  • Written and copyrighted ©2022-2023 by Marcin Orlowski <mail (#) marcinorlowski (.) com>
  • Text Table is open-sourced software licensed under the MIT license