maddhatter / markdown-table
Dynamically generate markdown tables
Installs: 76 520
Dependents: 7
Suggesters: 0
Security: 0
Stars: 26
Watchers: 3
Forks: 19
Open Issues: 4
Requires
- php: >=5.6.0
- illuminate/contracts: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- phpspec/phpspec: ^3.4
This package is auto-updated.
Last update: 2024-12-10 13:26:38 UTC
README
A small package to dynamically generate Markdown tables, as described here.
Install
Install using composer:
composer require maddhatter/markdown-table
Usage
// create instance of the table builder $tableBuilder = new \MaddHatter\MarkdownTable\Builder(); // add some data $tableBuilder ->headers(['Tables','Are','Cool']) //headers ->align(['L','C','R']) // set column alignment ->rows([ // add multiple rows at once ['col 1 is', 'left-aligned', '$1600'], ['col 2 is', 'centered', '$12'], ]) ->row(['col 3 is', 'right-aligned', '$1']); // add a single row // display the result echo $tableBuilder->render();
Result
| Tables | Are | Cool |
|----------|:-------------:|------:|
| col 1 is | left-aligned | $1600 |
| col 2 is | centered | $12 |
| col 3 is | right-aligned | $1 |