PHPackages                             hafizhfadh/laravel-simple-datatable - 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. [API Development](/categories/api)
4. /
5. hafizhfadh/laravel-simple-datatable

ActiveLibrary[API Development](/categories/api)

hafizhfadh/laravel-simple-datatable
===================================

A Laravel-native datatable engine providing both server-side and client-side processing modes.

v1.0.1(2mo ago)02[4 PRs](https://github.com/hafizhfadh/laravel-simple-datatable/pulls)MITPHPPHP ^8.3CI passing

Since Feb 27Pushed 1mo agoCompare

[ Source](https://github.com/hafizhfadh/laravel-simple-datatable)[ Packagist](https://packagist.org/packages/hafizhfadh/laravel-simple-datatable)[ Docs](https://github.com/hafizhfadh/laravel-simple-datatable)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/hafizhfadh-laravel-simple-datatable/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Simple Datatable
========================

[](#laravel-simple-datatable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8f9b6888620c924db82bac7a735ae1ef56fd46eaf1692217859dfba9e54dc487/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686166697a68666164682f6c61726176656c2d73696d706c652d646174617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hafizhfadh/laravel-simple-datatable)[![Tests](https://camo.githubusercontent.com/eec31fda91e8ee0683bd828ce6220be2be47b87901f69f63a03099d5f7a6ab83/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f686166697a68666164682f6c61726176656c2d73696d706c652d646174617461626c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/hafizhfadh/laravel-simple-datatable/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/add4869a6ad645e9b082fcbc2fb4422d3d0a52fc119df8ad15730ad0c870dff3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686166697a68666164682f6c61726176656c2d73696d706c652d646174617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hafizhfadh/laravel-simple-datatable)

**Laravel Simple Datatable** is a lightweight, framework-native engine designed to bridge Laravel with [simple-datatables](https://github.com/fiduswriter/Simple-DataTables) (and similar frontend libraries). It provides a fluent, secure, and pipeline-driven approach to handling server-side and client-side data processing without the bloat of jQuery or heavy dependencies.

Built with **TailwindCSS v4** compatibility in mind and engineered for **Laravel 11.x &amp; 12.x**, this package offers enterprise-grade performance with a developer-friendly API.

🚀 Key Features
--------------

[](#-key-features)

- **Dual Processing Modes**: Seamlessly switch between **Server-side** (Eloquent Builder) and **Client-side** (Collection) modes.
- **Pipeline-Driven Architecture**: Modular execution flow using Laravel's pipeline pattern for Search, Sort, and Pagination stages.
- **Secure by Default**: Explicit column whitelisting, strict sort direction validation, and parameterized queries to prevent SQL injection.
- **Fluent API**: Define columns and configuration using a clean, chainable syntax.
- **No Frontend Dependencies**: Pure PHP backend logic that outputs standard JSON, giving you complete freedom over your frontend stack.
- **PHP 8.3+ &amp; Strict Typing**: Leveraging the latest PHP features for reliability and performance.

📦 Installation
--------------

[](#-installation)

You can install the package via composer:

```
composer require hafizhfadh/laravel-simple-datatable
```

🔧 Usage
-------

[](#-usage)

### 1. Basic Setup

[](#1-basic-setup)

The simplest way to use the datatable is by passing an Eloquent query or a Collection to the `make` method.

#### Server-Side (Recommended for Large Datasets)

[](#server-side-recommended-for-large-datasets)

```
use HafizhFadh\LaravelSimpleDatatable\Facades\SimpleDatatable;
use HafizhFadh\LaravelSimpleDatatable\Support\Column;
use App\Models\User;

public function index()
{
    // Automatically detects Builder and enables Server Mode
    return SimpleDatatable::make(User::query())
        ->columns([
            Column::make('name')->searchable()->sortable(),
            Column::make('email')->searchable(),
            Column::make('created_at')->sortable(),
        ])
        ->process();
}
```

#### Client-Side (Fallback for Small Datasets)

[](#client-side-fallback-for-small-datasets)

```
use HafizhFadh\LaravelSimpleDatatable\Facades\SimpleDatatable;
use HafizhFadh\LaravelSimpleDatatable\Support\Column;

public function index()
{
    $users = User::all(); // Returns a Collection

    // Automatically detects Collection and enables Client Mode
    return SimpleDatatable::make($users)
        ->columns([
            Column::make('name')->searchable()->sortable(),
            Column::make('email')->searchable(),
        ])
        ->process();
}
```

### 2. Column Configuration

[](#2-column-configuration)

Columns must be explicitly defined to enable interaction. This is a security feature to prevent arbitrary sorting or searching on sensitive fields.

```
Column::make('username')
    ->searchable() // Allows filtering by this column
    ->sortable();  // Allows sorting by this column
```

### 3. Frontend Integration

[](#3-frontend-integration)

This package outputs a JSON response compatible with most datatable libraries. Here is an example response structure:

**Server Mode Response:**

```
{
    "data": [...],
    "meta": {
        "current_page": 1,
        "per_page": 10,
        "last_page": 5,
        "total": 42
    }
}
```

**Client Mode Response:**

```
{
    "data": [...],
    "meta": {
        "mode": "client",
        "total": 42
    }
}
```

🎨 Frontend Integration
----------------------

[](#-frontend-integration)

For a comprehensive guide on integrating this package with **simple-datatables** and styling it with **TailwindCSS v4**, please refer to our [Frontend Integration Guide](docs/frontend-integration.md).

⚙️ Advanced Configuration
-------------------------

[](#️-advanced-configuration)

### Manual Mode Selection

[](#manual-mode-selection)

You can force a specific mode if needed:

```
SimpleDatatable::make(User::query())
    ->clientSide() // Force fetching all data and processing in memory
    ->process();
```

### Request Injection

[](#request-injection)

By default, the engine uses the current global request. You can inject a custom request instance:

```
SimpleDatatable::make($query)
    ->request($customRequest)
    ->process();
```

🧪 Testing
---------

[](#-testing)

We use **Pest** for testing. To run the test suite:

```
composer test
```

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

1. Fork the repository.
2. Create a new feature branch.
3. Commit your changes.
4. Push to the branch.
5. Open a Pull Request.

🔒 Security
----------

[](#-security)

If you discover any security related issues, please email  instead of using the issue tracker.

📄 License
---------

[](#-license)

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

---

**HafizhFadh/LaravelSimpleDatatable** — Simple, Secure, Scalable.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance88

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.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 ~0 days

Total

2

Last Release

74d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0df268e10d0f35efb9b50c2351b5df8781f663a2b3c601b24d1d2008482ab008?d=identicon)[hafizhfadh](/maintainers/hafizhfadh)

---

Top Contributors

[![hafizhfadh](https://avatars.githubusercontent.com/u/20598933?v=4)](https://github.com/hafizhfadh "hafizhfadh (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laraveldatatabletailwindcsssimple-datatables

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/hafizhfadh-laravel-simple-datatable/health.svg)

```
[![Health](https://phpackages.com/badges/hafizhfadh-laravel-simple-datatable/health.svg)](https://phpackages.com/packages/hafizhfadh-laravel-simple-datatable)
```

###  Alternatives

[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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