PHPackages                             amirami/livewire-datatables - 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. amirami/livewire-datatables

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

amirami/livewire-datatables
===========================

Livewire DataTables components for back-end. Modular, easy to use, with tons of features.

83871PHP

Since Sep 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/amiranagram/livewire-datatables)[ Packagist](https://packagist.org/packages/amirami/livewire-datatables)[ RSS](/packages/amirami-livewire-datatables/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Livewire DataTables
===================

[](#livewire-datatables)

[![GitHub Tests Action Status](https://camo.githubusercontent.com/ff380bb0dd1b928150d37f9fd85c6770a526ca8cee00633bb0d35cd524a406e3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616d6972616e616772616d2f6c697665776972652d646174617461626c65732f72756e2d74657374733f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/amiranagram/livewire-datatables/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/406b8a10ec9722f3654d1b1ea5a7325615e706534a19aa348ffcee61de6cce49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d6972616d692f6c697665776972652d646174617461626c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/amirami/livewire-datatables)[![Latest Version on Packagist](https://camo.githubusercontent.com/6ecd6daf488bf70ebe7a14e9ae77a970fe241dc9bd65097a77e8fee1dd65e365/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d6972616d692f6c697665776972652d646174617461626c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/amirami/livewire-datatables)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fd4c7fb93845f00e51f8e7b391662a736bf8b71d652b228185a613af9bb5290b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616d6972616e616772616d2f6c697665776972652d646174617461626c65732f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/amiranagram/livewire-datatables/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)

Livewire DataTables components for back-end. Modular, easy to use, with tons of features.

Inspired by [Caleb's](https://github.com/calebporzio) [Livewire Screencasts](https://laravel-livewire.com/screencasts), dedicated to my friend [Bardh](https://github.com/bardh7).

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

[](#installation)

You can install the package via composer:

```
composer require amirami/livewire-datatables
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Amirami\LivewireDataTables\LivewireDataTablesServiceProvider" --tag="livewire-datatables-config"
```

This is the contents of the published config file:

```
return [

    'multi_column_sorting' => false,

    'row_caching' => false,

];
```

This means that by default these two options are disabled. But you can enable them for individual components.

Usage
-----

[](#usage)

After creating your Livewire component, extend the component class with `Amirami\LivewireDataTables\DataTable`. The `DataTable` abstract class will ask you to implement `getQueryProperty` method. This is a computed property in Livewire which needs to return and instance of `Illuminate\Database\Eloquent\Builder` or `\Illuminate\Database\Eloquent\Relations\Relation`.

This is the part where you will build the base of your query, with filters.

```
namespace App\Http\Livewire;

use App\Models\Post;
use Amirami\LivewireDataTables\DataTable;
use Illuminate\Database\Eloquent\Builder;

class PostsIndex extends DataTable
{
    public function getQueryProperty(): Builder
    {
        return Post::query();
    }

    public function render()
    {
        $posts = $this->entries;

        return view('livewire.posts-index', compact('posts'));
    }
}
```

This is the most basic component without any datatable features. Although it is totally fine to use the datatable without any features, it kinda beats the purpose of this package. Now let's get onto the many features this package provides.

### Pagination

[](#pagination)

Pagination offers exactly the same features as Livewire's default one. It actually extends it. The only reason you'll have to use the pagination provided by this package is because Livewire's default one doesn't play nice with our other features.

```
namespace App\Http\Livewire;

use Amirami\LivewireDataTables\DataTable;
use Amirami\LivewireDataTables\Traits\WithPagination;

class PostsIndex extends DataTable
{
    use WithPagination;
}
```

You can configure how many result you want to see per page as well. If not defined the paginator will pull the default number from the model class.

```
namespace App\Http\Livewire;

use Amirami\LivewireDataTables\DataTable;
use Amirami\LivewireDataTables\Traits\WithPagination;

class PostsIndex extends DataTable
{
    use WithPagination;

    // As a property.
    public $perPage = 20;

    // Or as a method.
    public function getPerPage(): ?int
    {
        return 42;
    }
}
```

For everything else about pagination check out the [Livewire's official documentation](https://laravel-livewire.com/docs/2.x/pagination).

### Searching

[](#searching)

If you want to use rows searching you have to use `WithSearching` trait, bind an input to a component property and define searchable columns. Consider the rest handled. This is how easy it is:

```
namespace App\Http\Livewire;

use Amirami\LivewireDataTables\DataTable;
use Amirami\LivewireDataTables\Traits\WithSearching;

class PostsIndex extends DataTable
{
    use WithSearching;

    public $searchableColumns = [
        'title',
        'content',
    ];

    public function render()
    {
        $posts = $this->entries;

        return view('livewire.posts-index', compact('posts'));
    }
}
```

```

            Title
            Excerpt
            Author
            Status

        @foreach($posts as $post)

                {{ $post->title }}
                {{ $post->excerpt }}
                {{ $post->user->name }}
                {{ $post->status() }}

        @endforeach

```

### Sorting

[](#sorting)

### Filtering

[](#filtering)

### Row Caching

[](#row-caching)

Planned Features
----------------

[](#planned-features)

- Searching, sorting and filtering by relationship fields
- Bulk Actions
- Row Grouping
- Front-end components (will most-likely be a separate package)

Showcase
--------

[](#showcase)

Check out cool datatables built with `livewire-datatables` [here](https://github.com/amiranagram/livewire-datatables/discussions/categories/show-and-tell), and don't forget to share your own 🙌.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Amir Rami](https://github.com/amiranagram)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

20

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![amiranagram](https://avatars.githubusercontent.com/u/38536188?v=4)](https://github.com/amiranagram "amiranagram (10 commits)")

---

Tags

datatableslaravellivewirelivewire-componentslivewire-datatables

### Embed Badge

![Health badge](/badges/amirami-livewire-datatables/health.svg)

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

PHPackages © 2026

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