8ctopus / array-to-table
将php数组转换为bootstrap 5表格
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
将php数组转换为Twitter bootstrap 5表格。
安装和演示
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();
您还可以检查示例 demo.php
。
测试
composer test
整洁的代码
composer fix(-risky)