jacopo/bootstrap-3-table-generator
Composer 安装命令:
composer require jacopo/bootstrap-3-table-generator
包简介
Dynamic table generator for bootstrap 3
README 文档
README
This package is a dynamic table generator for Bootstrap 3 written in Php. This package is fully tested and ready for use.
Installation
The first requisite to run the package is to include Bootstrap 3 in your Application. For more info see: this link.
The next step is to install this package through Composer. Edit your project's composer.json file to require "jacopo/bootstrap-3-table-generator": "dev-master".
"require": {
"jacopo/bootstrap-3-table-generator": "dev-master"
},
"minimum-stability" : "dev"
Next, update Composer from the Terminal:
composer update
That's it. You successfully installed Bootstrap 3 table generator!
Usage
To use te package you need to require Jacopo\Bootstrap3Table\BootstrapTable.
Here is an example for a quick usage of the tool:
use Jacopo\Bootstrap3Table\BootstrapTable; // create the generator class $table = new BootstrapTable(); // set the configuration $table->setConfig(array("table-hover"=>false, "table-condensed"=>true, "table-striped"=>true ) ); // set header content (optional) $table->setHeader(array("firstCol") ); // add table row $table->addRows(array("cell1","cell2"), array("custom-class1")); // you can also add a bigger row $table->addRows(array("cell1","cell2","cell3")); // or add a smaller row $table->addRows(array("cell1")); // setup extra custom css classes for the table $table->setTableExtraClasses(array("extra-table")); // print the table echo $table; // equals to echo $table->getHtml();
Methods overview
The methods available are:
setConfig: set the base configuration of the table. Accepts an array of options. The option available are:
table-striped: Adds zebra-striping to any table row .
table-bordered: Add borders and rounded corners to the table.
table-hover: Enable a hover state on table rows.
table-condensed: Makes tables more compact by cutting cell padding in half.
table-responsive: Makes table responsive.
id: Set the id of the table.
You can also add extra css classes to the <table>tag. To do that you need to set the
setTableExtraClasses()method.
Example:
$table = new BootstrapTable(); $table->setTableExtraClasses(array("extra-custom-class") );
setHeader: this method setup the header of the file, the only parameter is an array that contains the data of each <th>.
Setting header is optional, if not setted the header won't be shown.
Example:
$table = new BootstrapTable(); $table->setHeader(array("First header column data") );
addRows: add a row of data to the table. Accepts two params: the fist is the array of data, the second is an array of custom css classes to add to the <tr> tag.
Example:
$table = new BootstrapTable(); $table->addRows(array("First data column data"), array("custom-class1") );
Dynamic Size
Keep in mind that you dont have to set the size of the table, you can add as many rows as you want and the table size will adjust automatically!
Printing the table
When you're done setting up you table you can just do echo $table and you'll see the table as html.
If you prefer you can get the html string of the table instead with the table->getHtml() method.
jacopo/bootstrap-3-table-generator 适用场景与选型建议
jacopo/bootstrap-3-table-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.58k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2013 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「bootstrap」 「table」 「create」 「bootstrap3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jacopo/bootstrap-3-table-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jacopo/bootstrap-3-table-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jacopo/bootstrap-3-table-generator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Plug-ins for DataTables
A component that allows creating responsive HTML tables or lists from data object
Adjacency List’ed Closure Table database design pattern implementation for Laravel. Includes restore of tree
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
A simple package to create tables in Discord messages.
统计信息
- 总下载量: 11.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 20
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-10-14