maddhatter/markdown-table

Dynamically generate markdown tables

Maintainers

👁 maddhatter

Package info

github.com/maddhatter/markdown-table

pkg:composer/maddhatter/markdown-table

Statistics

Installs: 141 096

Dependents: 11

Suggesters: 1

Stars: 25

Open Issues: 3

1.4.0 2025-02-25 20:32 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 9ee0dc63fb8df7530d0bb9b8d04c11ac5894ac95

  • Shawn Tunney <shawn.tunney.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-25 23:36:11 UTC


README

👁 Latest Stable Version
👁 Total Downloads
👁 Latest Unstable Version
👁 License
👁 Build Status

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 |