PHPackages                             coryrose/livewire-tables - 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. [Database &amp; ORM](/categories/database)
4. /
5. coryrose/livewire-tables

ActiveLibrary[Database &amp; ORM](/categories/database)

coryrose/livewire-tables
========================

An extension for Livewire that allows you to effortlessly scaffold datatables with optional pagination, search, and sort.

0.3.0(6y ago)8941.5k19[6 issues](https://github.com/coryrose1/livewire-tables/issues)[2 PRs](https://github.com/coryrose1/livewire-tables/pulls)MITPHPCI failing

Since Nov 4Pushed 6y ago2 watchersCompare

[ Source](https://github.com/coryrose1/livewire-tables)[ Packagist](https://packagist.org/packages/coryrose/livewire-tables)[ Docs](https://github.com/coryrose1/livewire-tables)[ RSS](/packages/coryrose-livewire-tables/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (6)Versions (8)Used By (0)

Livewire-Tables
===============

[](#livewire-tables)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7b5ec234d44866a7065ebf15d287148ee7e6f22286a16970e5a2dd83b99b2a55/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f7279726f73652f6c697665776972652d7461626c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coryrose/livewire-tables)[![Total Downloads](https://camo.githubusercontent.com/409c13883eff6bb1c9c20c60f5aea8efc5658ba419d0a0db6bf14a9b5cc7801d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f7279726f73652f6c697665776972652d7461626c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coryrose/livewire-tables)[![Build Status](https://camo.githubusercontent.com/0c425781bea29ebd78eba109e4126ecdcf269f35f9758c77d90133d039e3e040/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f7279726f73652f6c697665776972652d7461626c65732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/coryrose/livewire-tables)[![StyleCI](https://camo.githubusercontent.com/cb13a877afd1dbe223c631789c3f922d3ace958fdb334a9cce9b26afefbc2ebd/68747470733a2f2f7374796c6563692e696f2f7265706f732f31323334353637382f736869656c64)](https://styleci.io/repos/12345678)

An extension for [Livewire](https://laravel-livewire.com/docs/quickstart/) that allows you to effortlessly scaffold datatables with optional pagination, search, and sort.

Live demo website will be available soon.

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

[](#installation)

Via Composer

```
$ composer require coryrose/livewire-tables
```

The package will automatically register its service provider.

To publish the configuration file to `config/livewire-tables.php` run:

```
php artisan vendor:publish --provider="Coryrose\LivewireTables\LivewireTablesServiceProvider"

```

Usage
-----

[](#usage)

Livewire tables are created in three simple steps:

1. [Create a table component class](#create-a-table-component-class)
2. [Configure the table class using the available options](#configure-the-component-options)
3. [Scaffold the table view (as needed when component class changes)](#scaffold-the-table-view)

### Create a table component class

[](#create-a-table-component-class)

Run the make command to generate a table class:

`php artisan livewire-tables:make UsersTable`

*App/Http/Livewire/Tables/UsersTable.php*

```
...

class UsersTable extends LivewireModelTable
{
    use WithPagination;

        public $paginate = true;
        public $pagination = 10;
        public $hasSearch = true;

        public $fields = [
            [
                'title' => 'ID',
                'name' => 'id',
                'header_class' => '',
                'cell_class' => '',
                'sortable' => true,
            ],
            [
                'title' => 'Name',
                'name' => 'name',
                'header_class' => '',
                'cell_class' => '',
                'sortable' => true,
                'searchable' => true,
            ],
            [
                'title' => 'City',
                'name' => 'address.city',
                'header_class' => 'bolded',
                'cell_class' => 'bolded bg-green',
                'sortable' => true,
                'searchable' => true,
            ],
            [
                'title' => 'Post',
                'name' => 'post.content',
                'header_class' => '',
                'cell_class' => '',
                'sortable' => true,
                'searchable' => true,
            ],
        ];

        public function render()
        {
            return view('livewire.tables.users-table', [
                'rowData' => $this->query(),
            ]);
        }

        public function model()
        {
            return User::class;
        }

        public function with()
        {
            return ['address', 'post'];
        }
}

```

### Configure the component options

[](#configure-the-component-options)

First, set your base model in the `model()` method in the following format:

```
public function model()
{
    return User::class;
}

```

To eager load relationships, use the `with()` and return an array of relation(s):

```
public function with()
{
    return ['address', 'post'];
}

```

The following are editable public properties for the table class:

keydescriptionvaluedefault$paginateControls whether the data query &amp; results are paginated. If true, the class must `use WithPagination;`booltrue$paginationThe number value to paginate withinteger10$hasSearchControls global appearance of search barbooltrue[$fields](#$fields)The fields configuration for your tablearraynull[$css](#$css)Per-table CSS settingsarraynull#### $fields

[](#fields)

Controls the field configuration for your table

keydescriptionvaluetitleSet the displayed column titlestringnameShould represent the database field name. Use '.' notation for related columns, such as `user.address`stringheader\_classSet a class for the `` tag for this fieldstring or nullcell\_classSet a class for the `` tag for this fieldstring or nullsortableControl whether or not the column is sortablebool or nullsearchableControl whether or not the column is searchablebool or null#### $css

[](#css)

Used to generate CSS classes when scaffolding the table.

These can be set globally in the configuration file, or on a per-table basis in the component class.

*Note:* CSS classes set in the component will override those from the configuration file where both exist.

keydescriptionvaluewrapperCSS class for `` surrounding tablestring or nulltableCSS class for ``string or nulltheadCSS class for ``string or nullthCSS class for ``string or nulltbodyCSS class for ``string or nulltrCSS class for ``string or nulltdCSS class for ``string or nullsearch\_wrapperCSS class for `` surrounding searchstring or nullsearch\_inputCSS class for search ``string or nullpagination\_wrapperCSS class for `` surrounding pagination buttonsstring or null### Scaffold the table view

[](#scaffold-the-table-view)

When ready, scaffold the table view using the scaffold command:

`php artisan livewire-tables:scaffold UsersTable`

*resources/views/livewire/tables/users-table.blade.php*

```

    @if ($hasSearch)

            @if ($search)
                &#10005;
            @endif

    @endif

            ID
            Name
            City
            Post

        @foreach ($rowData as $row)

                {{ $row->id }}
                {{ $row->name }}
                {{ $row->address->city }}
                {{ $row->post->content }}

        @endforeach

    @if ($paginate)

        {{ $rowData->links() }}

    @endif

```

You can use the scaffold command continuously as you make changes to the parent component class.

Since the rendered template is simple HTML, there’s no need for table “slots” for customization - customize the template as you see fit!

Todo
----

[](#todo)

- Further support for more advanced queries than a model

Change log
----------

[](#change-log)

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

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Credits
-------

[](#credits)

- [Cory Rosenwald](https://github.com/coryrose)
- [Laravel Livewire](https://laravel-livewire.com/docs/quickstart/)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% 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 ~4 days

Total

5

Last Release

2363d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56bb1803aea04bcb4464de5d284f5565a3ac92622652b454399dfc96ac73802a?d=identicon)[coryrose1](/maintainers/coryrose1)

---

Top Contributors

[![crosenwald](https://avatars.githubusercontent.com/u/14092825?v=4)](https://github.com/crosenwald "crosenwald (21 commits)")[![coryrose1](https://avatars.githubusercontent.com/u/19687298?v=4)](https://github.com/coryrose1 "coryrose1 (12 commits)")

---

Tags

datatableslaravellivewirelivewire-tablestableslaravellivewirelivewire-tables

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/coryrose-livewire-tables/health.svg)

```
[![Health](https://phpackages.com/badges/coryrose-livewire-tables/health.svg)](https://phpackages.com/packages/coryrose-livewire-tables)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)

PHPackages © 2026

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