1. Go to this page and download the library: Download sabat24/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/ */
sabat24 / markdown-table example snippets
use sabat24\MarkdownTable\Table;
$table = new Table(['Branch', 'Commit']);
echo $table->getString([
['main', '0123456789abcdef'],
['staging', 'fedcba9876543210'],
]);
use sabat24\MarkdownTable\Table;
// Using a custom function for handling special characters like emoji properly
function stringWidth($string): int
{
// This is a simplified example - in production, you might want
// a more sophisticated library that handles all Unicode properties
$pattern = '/[\p{East_Asian_Width=F}\p{East_Asian_Width=W}]/u';
$wide = preg_match_all($pattern, $string, $matches);
return mb_strlen($string) + $wide;
}
$table = new Table(['Alpha', 'Bravo']);
$table->setStringLengthFunction('stringWidth');
echo $table->getString([
['中文', 'Charlie'],
['👩❤️👩', 'Delta'],
]);
use sabat24\MarkdownTable\Table;
$table = new Table(['Feature', 'Description']);
$table->setOptions(['allowedTags' => ['br', 'strong', 'em']]);
echo $table->getString([
['Line breaks', 'First line<br/>Second line'],
['Formatting', '<strong>Bold text</strong> and <em>italic text</em>'],
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.