PHPackages                             okipa/laravel-bootstrap-table-list - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. okipa/laravel-bootstrap-table-list

Abandoned → [https://github.com/Okipa/laravel-table](/?search=https%3A%2F%2Fgithub.com%2FOkipa%2Flaravel-table)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

okipa/laravel-bootstrap-table-list
==================================

Bootstrap table list generator for Laravel.

2.1.10(7y ago)154.4k7[1 PRs](https://github.com/Okipa/laravel-bootstrap-table-list/pulls)MITPHPPHP &gt;=7.1

Since Oct 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Okipa/laravel-bootstrap-table-list)[ Packagist](https://packagist.org/packages/okipa/laravel-bootstrap-table-list)[ Docs](https://github.com/Okipa/laravel-bootstrap-table-list)[ RSS](/packages/okipa-laravel-bootstrap-table-list/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (35)Used By (0)

Laravel Bootstrap Table List
============================

[](#laravel-bootstrap-table-list)

[![Source Code](https://camo.githubusercontent.com/dce2078151f1bd17f249ed12f975ec0ed270c633d80aaf58cd74941ac23da954/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d6f6b6970612f6c61726176656c2d2d626f6f7473747261702d2d7461626c652d2d6c6973742d626c75652e737667)](https://github.com/Okipa/laravel-bootstrap-table-list)[![Latest Version](https://camo.githubusercontent.com/ca08c8de4dac21fc89d62f5d6649f8d9b5686b60c8295b3b1ad63d703dbd0447/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6f6b6970612f6c61726176656c2d626f6f7473747261702d7461626c652d6c6973742e7376673f7374796c653d666c61742d737175617265)](https://github.com/Okipa/laravel-bootstrap-table-list/releases)[![Total Downloads](https://camo.githubusercontent.com/f7b89022f6b15ab3f1a119e996c38b73e836fbe179a792a72dcf28259ea4be4d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6b6970612f6c61726176656c2d626f6f7473747261702d7461626c652d6c6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/okipa/laravel-bootstrap-table-list)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![Build Status](https://camo.githubusercontent.com/462e7f9f454cdc2e6aeac7764f1529b7f10b654799f20f9a2411411d00b58c0b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f6b6970612f6c61726176656c2d626f6f7473747261702d7461626c652d6c6973742f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Okipa/laravel-bootstrap-table-list/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/24b177a8b36d01936d444a22629e93d0f7c8f30b8366ffd497309c405e2f933c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f6b6970612f6c61726176656c2d626f6f7473747261702d7461626c652d6c6973742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Okipa/laravel-bootstrap-table-list/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/777fe6aa6f89b361524602d56d71ab4449fc471352d5f297aebf43312a1cb851/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f6b6970612f6c61726176656c2d626f6f7473747261702d7461626c652d6c6973742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Okipa/laravel-bootstrap-table-list/?branch=master)

Because it is sometimes convenient to build a simple backoffice without sophisticated javascript treatments, Laravel Bootstrap Table List proposes a model-based and highly customizable php table list generation, that simply render your table HTML in your view, with a code-side-configuration.

⚠️⚠️⚠️ **This package has been replaced by .** ⚠️⚠️⚠️
⚠️⚠️⚠️ **Only bug fixes will be merged. Please consider moving to the new package.** ⚠️⚠️⚠️

---

Before use
----------

[](#before-use)

This V2 of this table list generator is pre-configured for **Bootstrap 4** and **Fontawesome 5**.
However, this package is deeply configurable and it is possible to easily set it up for Bootstrap 3 and other versions of FA or other icon libraries (or not icon at all).
If the configuration does not give enough possibilities for your customization needs, you definitely should [publish the templates and customize them](#customize-templates) in your project.

**Notes:**
If someone is motivated to give me a functional configuration for **bootstrap 3**, I will include it in the readme. It could interest some developers.
Anyway, a pre-configured **bootstrap 3** version of this package does exists (with less features) : [please check the v1](https://github.com/Okipa/laravel-bootstrap-table-list/tree/v1).

---

Installation
------------

[](#installation)

- Install the package with composer :

```
composer require okipa/laravel-bootstrap-table-list:^2.0
```

- Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider. If you don't use auto-discovery or if you use a Laravel 5.4- version, add the package service provider in the `register()` method from your `app/Providers/AppServiceProvider.php` :

```
// laravel bootstrap table list
// https://github.com/Okipa/laravel-bootstrap-table-list
$this->app->register(Okipa\LaravelBootstrapTableList\TableListServiceProvider::class);
```

- Load the package `CSS` or `SASS` file from the `[path/to/composer/vendor]/okipa/laravel-bootstrap-table-list/styles` directory to your project.

---

Package usage
-------------

[](#package-usage)

### Basic usage

[](#basic-usage)

In your controller, simply call the package like the following example to generate your table list :

```
// we instantiate a table list in the news controller
$table = app(TableList::class)
    ->setModel(News::class)
    ->setRoutes([
        'index' => ['alias' => 'news.index', 'parameters' => []],
    ]);
// we add some columns to the table list
$table->addColumn('title')
    ->isSortable()
    ->isSearchable()
    ->useForDestroyConfirmation();
```

Then, send your `$table` object in your view and render your table list :

```
{{ $table }}
```

That's it !

### Notes :

[](#notes-)

- **Request** : No need to transmit the request to the TableList : it systematically uses the current request given by the `request()` helper to get the number of lines to show and the searching, sorting or pagination data. However, if you need to pass a particular request to the TableList, you can do it with the `setRequest()` method.
- **Column titles** : By default, the columns titles take the following value : `trans('validation.attributes.[attribute])`. You can set a custom title using the `setTitle()` method, especially when a a column is not related to a table attribute.

### Advanced usage

[](#advanced-usage)

If you need your table list for a more advanced usage, with a multilingual project for example, here is an example of what you can do in your controller :

```
// create your tablelist instance
$table = app(TableList::class)
    // set the model namespace
    ->setModel(News::class)
    // set a custom request to the table list rather than the request() one.
    ->setRequest($request)
    // set the route that will be targetted when the create / edit / delete button will be hit.
    ->setRoutes([
        'index'      => ['alias' => 'news.index', 'parameters' => []],
        'create'     => ['alias' => 'news.create', 'parameters' => []],
        'edit'       => ['alias' => 'news.edit', 'parameters' => []],
        'destroy'    => ['alias' => 'news.destroy', 'parameters' => []],
    ])
    // set the default number of rows to show in your table list.
    ->setRowsNumber(50)
    // show the rows number selector that will enable you to choose the number of rows to show.
    ->enableRowsNumberSelector()
    // add some query instructions for the special use cases
    ->addQueryInstructions(function ($query) use ($category_id) {
        // some examples of what you can do
        $query->select('news.*');
        // add a constraint
        $query->where('category_id', $category_id);
        // get value stored in a json field
        $query->addSelect('news.json_field->>json_attribute as json_attribute');
        // get a formatted value form a pivot table
        $query->selectRaw('count(comments.id) as comments_count');
        $query->leftJoin('news_commment', 'news_commment.news_id', '=', 'news.id');
        $query->leftJoin('comments', 'comments.id', '=', 'news_commment.comment_id');
        $query->groupBy('comments.id');
        // alias a value to make it available from the column model
        $query->addSelect('users.name as author');
        $query->join('users', 'users.id', '=', 'news.author_id');
    })
    // display some lines as disabled
    ->disableLines(function($model){
        return $model->id === 1 || $model->id === 2;
    }, ['disabled', 'bg-secondary'])
    // display some line as highlighted
    ->highlightLines(function($model){
        return $model->id === 3;
    }, ['highlighted', 'bg-success']);
// you can now join some columns to your tablelist.
// display the news image from a custom HTML element.
$table->addColumn('image')
    ->isCustomHtmlElement(function ($entity, $column) {
        return $entity->{$column->attribute})
            ? ''
            : null;
    });
// display the news title that is contained in the news table and use this field in the destroy confirmation modal.
// this field will also be searchable in the search field.
$table->addColumn('title')
    ->isSortable()
    ->isSearchable()
    ->useForDestroyConfirmation();
// display an abreviated content from a text with the number of caracters you want.
$table->addColumn('content')
    ->setStringLimit(30);
// display a value from a sql alias
// in this case, you will target the `users` table and the `author` field, and make this sortable and searchable.
// this way, you tell the tablelist to manipulate the `name` attribute in the sql queries but to display the aliased `author` model attribute.
$table->addColumn('author')
    ->setCustomTable('users', 'name')
    ->isSortable()
    ->isSearchable();
// display the category with a custom column title, as a button, prefixed with an icon and with a value contained in config.
$table->addColumn('category_id')
    ->setTitle('Category custom name')
    ->setIcon('your-icon')
    ->isButton(['btn', 'btn-sm', 'btn-outline-primary'])
    ->isCustomValue(function ($entity, $column) {
        return config('news.category.' . $entity->{$column->attribute});
    });
// display a button to preview the news
$table->addColumn()
    ->isLink(function($entity, $column){
        return route('news.show', ['id' => $entity->id]);
    })
    ->isButton(['btn', 'btn-sm', 'btn-primary']);
// display the formatted release date of the news and choose to sort the list by this field by default.
$table->addColumn('released_at')
    ->isSortable()
    ->sortByDefault('desc')
    ->setColumnDateTimeFormat('d/m/Y H:i:s');
```

---

API
---

[](#api)

### TableList public methods

[](#tablelist-public-methods)

##### `public function setModel(string $tableModel): \Okipa\LaravelBootstrapTableList\TableList`

[](#public-function-setmodelstring-tablemodel-okipalaravelbootstraptablelisttablelist)

Set the model used for the table list generation (required).

##### `public function setRequest(Request $request): \Okipa\LaravelBootstrapTableList\TableList`

[](#public-function-setrequestrequest-request-okipalaravelbootstraptablelisttablelist)

Set the request used for the table list generation (required).

##### `public function setRoutes(array $routes): \Okipa\LaravelBootstrapTableList\TableList`

[](#public-function-setroutesarray-routes-okipalaravelbootstraptablelisttablelist)

Set the routes used for the table list generation (required) :

- Each route will be generated with the line entity id. The given extra parameters will be added for the route generation.
- The `index` route is required and must be the route that will be used to display the page that contains the table list.
- The following routes can be defined as well :
    - `create` : must be used to redirect toward the entity creation page. Displays a `Create` button under the table list if defined.
    - `edit` : must be used to redirect toward the entity edition page. Displays a `Edit` icon on each table list line if defined.
    - `destroy` : must be used to destroy a table list line. Displays a `Remove` icon on each table list line if defined.
    - Each route have to be defined with the following structure :

```
'index' => [
    'alias' => 'news.index',
    'parameters' => [
        // set your extra parameters here or let the array empty
    ]
]
```

##### `public function setRowsNumber(int $owsNumber): TableList`

[](#public-function-setrowsnumberint-owsnumber-tablelist)

Set a custom number of rows for the table list (optional).

##### `public function enableRowsNumberSelector(): TableList`

[](#public-function-enablerowsnumberselector-tablelist)

Enables the rows number selection in the table list (optional) :

- Calling this method displays a rows number input that enable the user to choose how much rows to show.

##### `public function addQueryInstructions(Closure $queryClosure): TableList`

[](#public-function-addqueryinstructionsclosure-queryclosure-tablelist)

Set the query closure that will be used during the table list generation (optional).
For example, you can define your joined tables here.
The closure let you manipulate the following attribute : $query`.

##### `public function disableLines(Closure $disableLinesClosure, array $lineClass = []): TableList`

[](#public-function-disablelinesclosure-disablelinesclosure-array-lineclass---tablelist)

Set the disable lines closure that will be executed during the table list generation (optional).
The optional second param let you set the class that will be applied for the disabled lines.
By default, the `config('tablelist.value.disabled_line.class')` config value is applied.
For example, you can disable the current logged user to prevent him being edited or deleted from the table list.
The closure let you manipulate the following attribute : $model.

##### `public function highlightLines(Closure $highlightLinesClosure, array $lineClass = []): TableList`

[](#public-function-highlightlinesclosure-highlightlinesclosure-array-lineclass---tablelist)

Set the highlight lines closure that will executed during the table list generation (optional).
The optional second param let you set the class that will be applied for the highlighted lines.
By default, the `config('tablelist.value.highlighted_line.class')` config value is applied.
The closure let you manipulate the following attribute : $model.

##### `public function addColumn(string $attribute = null) : TableList`

[](#public-function-addcolumnstring-attribute--null--tablelist)

Add a column that will be displayed in the table list (required) :

- At least one column must be added to the table list.
- A column can be created without attribute specification, in case of HTML element display, for example.

### TableListColumn public methods

[](#tablelistcolumn-public-methods)

##### `public function setTitle(string $title): TableListColumn`

[](#public-function-settitlestring-title-tablelistcolumn)

Set the column title (optional).

##### `public function sortByDefault(string $direction = 'asc'): TableListColumn`

[](#public-function-sortbydefaultstring-direction--asc-tablelistcolumn)

Set the default sorted column (required).

##### `public function useForDestroyConfirmation(): TableListColumn`

[](#public-function-usefordestroyconfirmation-tablelistcolumn)

Use the column attribute for the destroy confirmation message generation (required) :

- At least one column must be selected for destroy confirmation if a destroy route is set.
- This method can be called only once.

##### `public function isSortable(): TableListColumn`

[](#public-function-issortable-tablelistcolumn)

Make the column sortable (optional).

##### `public function isSearchable(): TableListColumn`

[](#public-function-issearchable-tablelistcolumn)

Make the column searchable (optional).

##### `public function setCustomTable(string $customColumnTable, string $customColumnTableRealAttribute = null): TableListColumn`

[](#public-function-setcustomtablestring-customcolumntable-string-customcolumntablerealattribute--null-tablelistcolumn)

Define the custom related table for the column attribute (optional).
Defining the custom related table becomes mandatory if you define your column as searchable and if the column attribute does not directly belong to the table list model table. The custom real attribute will only be used for the sql request and will also be required only if the defined column attribute does not directly exist in the defined custom table.

Examples :

```
$table = app(TableList::class)->setRoutes($routes)
    ->setModel(Company::class)
    ->addQueryInstructions(function($query) {
        $query->select('companies.*');
        $query->addSelect('users.name as owner');
        $query->join('users', 'users.id', '=', 'companies.owner_id');
    });
// Here, you target the `owner` attribute, which is an alias produced in the `addSelect` bellow, and which will be attached to the `Company` object.
// Displaying and sorting this alias attribute wouldn't cause any problem but here, we want to authorize the search by owner.
// As this attribute does not really exist in the users table, you have to precise which real field to use for the search sql request : the `name` attribute.
$table->addColumn('owner')
    ->setCustomTable('users', 'name')
    ->isSearchable();

```

##### `public function setColumnDateTimeFormat(string $columnDateFormat): TableListColumn`

[](#public-function-setcolumndatetimeformatstring-columndateformat-tablelistcolumn)

Set the format for a datetime, date or time attribute (optional).
(Carbon::parse($value)-&gt;format($format) method is used under the hood).

##### `public function isButton(array $buttonClass = []): TableListColumn`

[](#public-function-isbuttonarray-buttonclass---tablelistcolumn)

Set the column button class (optional).
The attribute is wrapped into a button.

##### `public function setIcon(string $icon, $showWithNoValue = false): TableListColumn`

[](#public-function-seticonstring-icon-showwithnovalue--false-tablelistcolumn)

Set the icon to display before the value (optional).

##### `public function setStringLimit(int $stringLimit): TableListColumn`

[](#public-function-setstringlimitint-stringlimit-tablelistcolumn)

Set the string value display limitation (optional).
Shows "..." when the limit is reached....ravel-bootstrap-table-list/src/Traits/RoutesValidationChecks.php

##### `public function isLink($url = null): TableListColumn`

[](#public-function-islinkurl--null-tablelistcolumn)

Set the link url.
You can declare the link as a string or as a closure which will let you manipulate the following attributes : $entity, $column.
If no url is declared, it will be set with the column value.

##### `public function isCustomValue(Closure $customValueClosure): TableListColumn`

[](#public-function-iscustomvalueclosure-customvalueclosure-tablelistcolumn)

Set a custom value in the method closure (optional).
The closure let you manipulate the following attributes : $entity, $column.

##### `public function isCustomHtmlElement(Closure $customHtmlEltClosure): TableListColumn`

[](#public-function-iscustomhtmlelementclosure-customhtmleltclosure-tablelistcolumn)

Set the HTML element to render in the method closure (optional).
The closure let you manipulate the following attributes : $entity, $column.

---

Configurations
--------------

[](#configurations)

To personalize the package configuration, you have to publish it first with the following script :

```
php artisan vendor:publish --tag=tablelist::config
```

Then, open the published package configuration file (`config/tablelist.php`) and override the default table list configuration by setting your own values.

---

Customize translations
----------------------

[](#customize-translations)

You can customize the table list associated translation by publishing them in your project :

```
php artisan vendor:publish --tag=tablelist::translations
```

Once you have published them, You will find them in your `resources/lang` directory.

---

Customize templates
-------------------

[](#customize-templates)

Publish the package blade templates file in your project :

```
php artisan vendor:publish --tag=tablelist::views
```

Then, change the content from the package templates in your `resources/views/vendor/tablelist` directory.

---

Testing
-------

[](#testing)

```
composer test
```

---

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

---

Contributors
------------

[](#contributors)

- [Okipa](https://github.com/Okipa)
- [ACID-Solutions](https://github.com/ACID-Solutions)
- [Stephan de Souza](https://github.com/stephandesouza)

---

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Recently: every ~22 days

Total

34

Last Release

2645d ago

Major Versions

1.3.1 → 2.0.02018-06-08

PHP version history (2 changes)1.2.0PHP &gt;=7.0

2.0.7PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc5b2b60afe2f6f28bd3ef5105fc1883386967efcc744b1b6829b8eb289f5a91?d=identicon)[Okipa](/maintainers/Okipa)

---

Top Contributors

[![Okipa](https://avatars.githubusercontent.com/u/5328934?v=4)](https://github.com/Okipa "Okipa (26 commits)")[![stephandesouza](https://avatars.githubusercontent.com/u/159077?v=4)](https://github.com/stephandesouza "stephandesouza (1 commits)")

---

Tags

bootstrapentitiesgenerategenerationgeneratorhtmllaravellistokipapackagephptablephplaravelpackagegeneratorhtmllistbootstraptablegenerationentitiesgenerateokipa

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/okipa-laravel-bootstrap-table-list/health.svg)

```
[![Health](https://phpackages.com/badges/okipa-laravel-bootstrap-table-list/health.svg)](https://phpackages.com/packages/okipa-laravel-bootstrap-table-list)
```

###  Alternatives

[okipa/laravel-table

Generate tables from Eloquent models.

56752.8k](/packages/okipa-laravel-table)[okipa/laravel-form-components

Ready-to-use and customizable form components.

198.0k1](/packages/okipa-laravel-form-components)[netojose/laravel-bootstrap-4-forms

Bootstrap 4 form builder for Laravel 5

182115.3k](/packages/netojose-laravel-bootstrap-4-forms)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
