PHP code example of maddhatter / markdown-table

1. Go to this page and download the library: Download maddhatter/markdown-table library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

maddhatter / markdown-table example snippets


// 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();