dejurin/php-table-generate

Simple PHP HTML table generator by CodeIgniter.

1.0.0 2022-06-04 21:34 UTC

This package is auto-updated.

Last update: 2024-11-05 17:00:01 UTC


README

Packagist: https://packagist.org/packages/dejurin/php-table-generate

Simple PHP HTML table generator by CodeIgniter.

Installation

Install this package via Composer.

composer require dejurin/php-table-generate

Or edit your project's composer.json to require dejurin/php-table-generate and then run composer update.

"require": {
    "dejurin/php-table-generate": "^1.0.0"
}

Example

$table = new Dejurin\PHPTableGenerate();

$table->set_heading('Currency', 'Amount', 'Color');

$data = [
    [
        [
            'data' => 'Dollar',
            'td' => 'th',
            'scope' => 'row',
            'class' => 'style'
        ],  
        100,
        '#85bb65',
    ],
];

echo $table->generate($data);

/* 
<table border="0" cellpadding="4" cellspacing="0">
<thead>
<tr>
<th>Currency</th><th>Amount</th><th>Color</th></tr>
</thead>
<tbody>
<tr>
<th class="style" scope="row">Dollar</th><td>100</td><td>#85bb65</td></tr>
</tbody>
</table>
*/

License

This source code is distributed under MIT license.

Sponsors

https://currencyconvert.online/