8ctopus / array-to-table
php array to bootstrap 5 table
0.2.0
2023-12-28 12:09 UTC
Requires
- php: >=7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5|^10.0
README
Convert php array to Twitter bootstrap 5 table.
install and demo
composer require 8ctopus/array-to-table
<?php declare(strict_types=1); use Oct8pus\ArrayToTable\ArrayToTable; require_once __DIR__ . '/vendor/autoload.php'; $data = [ [ 'id' => 1, 'firstName' => 'John', 'transactionId' => 'A1-2019', 'refunded' => 0, 'purchaseDate' => '2019-12-01 00:00:00', 'expiryDate' => '2020-12-01 00:00:00', ], [ 'id' => 2, 'firstName' => 'Mark', 'transactionId' => 'A1-2020', 'refunded' => 0, 'purchaseDate' => '2020-12-05 00:00:00', 'expiryDate' => '2021-12-05 00:00:00', ], [ 'id' => 3, 'firstName' => 'Joe', 'transactionId' => 'A1-2022', 'refunded' => 1, 'purchaseDate' => '2022-12-05 00:00:00', 'expiryDate' => '2023-12-05 00:00:00', ], ]; echo (new ArrayToTable($data)) ->render();
You can also check the example demo.php
.
tests
composer test
clean code
composer fix(-risky)