PHPackages                             aler998/laravel-flux - 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. aler998/laravel-flux

ActiveLibrary

aler998/laravel-flux
====================

A Laravel package for building sortable, filterable and exportable data tables.

v1.0.0(1mo ago)01↑2900%MITPHPPHP ^8.2

Since Mar 28Pushed 1mo agoCompare

[ Source](https://github.com/Aler998/laravel-flux)[ Packagist](https://packagist.org/packages/aler998/laravel-flux)[ RSS](/packages/aler998-laravel-flux/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Flux — Laravel Data Table
=========================

[](#flux--laravel-data-table)

A Laravel package for building sortable, filterable, and exportable data tables. Define the table in your controller, drop a component in your Blade view — the rest is automatic.

Features
--------

[](#features)

- Sortable columns with visual indicators
- Smart filters in column headers (text, boolean, select, date range)
- Auto-search: debounce on text, immediate on select/date
- Inline boolean toggle with PATCH request
- Inline select dropdown with PATCH request
- Custom HTML templates per cell
- Export to Excel via `maatwebsite/excel` (customizable export class)
- Pagination with ellipsis for large datasets
- SlimSelect for styled dropdowns, Flatpickr for date range picker
- No CDN dependencies — all assets compiled and published locally

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 / 12

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

[](#installation)

```
composer require aler998/laravel-flux
```

Publish the compiled assets (required):

```
php artisan vendor:publish --tag=flux-assets
```

Publish the config file (optional):

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

Quick Start
-----------

[](#quick-start)

**Controller:**

```
use Aler998\Flux\Table\Table;
use Aler998\Flux\Table\Column;

public function index()
{
    $table = Table::make(User::class)
        ->columns([
            Column::make('id', 'ID')->sortable(),
            Column::make('name', 'Name')->sortable()->filterable(),
            Column::make('email', 'Email')->sortable()->filterable(),
            Column::make('created_at', 'Created')->date()->sortable()->filterable(),
        ])
        ->render();

    return view('users.index', compact('table'));
}
```

**Blade:**

```
{{-- Required in your layout for inline PATCH requests: --}}

{{-- In your view: --}}
{!! $table !!}
```

Column Types
------------

[](#column-types)

### Text (default)

[](#text-default)

```
Column::make('name', 'Name')->sortable()->filterable()
```

### Link

[](#link)

```
// Placeholders resolve to the row's field values
Column::make('name', 'Name')->link('/users/{id}')
Column::make('name', 'Name')->link('/users/{id}/edit', '_blank')
```

### Boolean toggle

[](#boolean-toggle)

Renders an on/off toggle. Sends a `PATCH` request on click. Reverts on failure.

```
Column::make('is_active', 'Active')
    ->boolean('/api/users/{id}', 'Active', 'Inactive')
    ->filterable()
```

Custom filter labels (independent from toggle labels):

```
->boolean('/api/users/{id}', 'Active', 'Inactive')
->filterLabels('Active', 'Inactive')
```

**Patch payload:** `{ "is_active": 1 }`

**Expected route:**

```
Route::patch('/api/users/{id}', function (Request $request, $id) {
    User::findOrFail($id)->update(['is_active' => $request->boolean('is_active')]);
    return response()->json(['ok' => true]);
});
```

### Inline select

[](#inline-select)

Renders a dropdown. Sends a `PATCH` request on change. Reverts on failure.

```
Column::make('status', 'Status')
    ->select([
        'active'   => 'Active',
        'inactive' => 'Inactive',
        'pending'  => 'Pending',
    ], '/api/users/{id}')
    ->filterable()
```

**Patch payload:** `{ "status": "active" }`

The filter automatically uses the same options. The Excel export writes the label (`Active`) instead of the key (`active`).

### Custom HTML template

[](#custom-html-template)

Renders arbitrary HTML in the cell. Use `{field}` placeholders — they are replaced with the row's field values. **HTML is not escaped.**

```
// Badge
Column::make('status', 'Status')
    ->template('{status}')

// Action buttons using fields from other columns
Column::make('name', 'Actions')
    ->template('Edit')

// Avatar image
Column::make('avatar', 'Avatar')
    ->template('')
```

Placeholders can reference **any field of the row**, not just the column's own field. In the Excel export, HTML tags are stripped automatically.

### Date

[](#date)

```
Column::make('created_at', 'Created')->date()              // 15/01/2024
Column::make('updated_at', 'Updated')->date('d/m/Y H:i')  // 15/01/2024 10:30
```

Adds a Flatpickr range picker as filter (single date or range).

### Hidden

[](#hidden)

```
Column::make('id', 'ID')->hidden()
```

Hidden columns are excluded from the table, the export and the SQL query.

Table Options
-------------

[](#table-options)

```
Table::make(User::class)
    ->columns([...])
    ->perPage(25)                      // rows per page, default 15
    ->filters([                        // pre-applied filters
        'status'           => 'active',
        'created_at__from' => '2024-01-01',
        'created_at__to'   => '2024-12-31',
    ])
    ->exportClass(MyCustomExport::class) // custom export class
    ->render()
```

Configuration
-------------

[](#configuration)

`config/flux.php`:

```
return [
    'route_prefix'    => 'flux',   // internal route prefix
    'middleware'      => ['web'],  // add 'auth' to protect endpoints
    'table_cache_ttl' => 120,      // minutes to cache table config
];
```

Filters
-------

[](#filters)

Filters appear automatically in the column headers when `->filterable()` is set. The filter type matches the column type:

Column typeFilterQuery`text` / `link`Text input (400ms debounce)`LIKE %value%``boolean`Select (All / True / False)`WHERE campo = 1/0``select`Select with column options`WHERE campo = 'value'``date`Flatpickr range picker`WHERE DATE(campo) >= from AND filters([
    'name'             => 'Mario',      // text filter
    'is_active'        => 1,            // boolean filter
    'status'           => 'pending',    // select filter
    'created_at__from' => '2024-01-01', // date range start
    'created_at__to'   => '2024-03-31', // date range end
])
```

Excel Export
------------

[](#excel-export)

The **Export Excel** button downloads a `.xlsx` file that respects the currently active filters and sorting. It includes:

- Bold headers with auto-sized columns
- Only visible columns
- Boolean columns export the label (`Active` / `Inactive`) instead of `1` / `0`
- Select columns export the label (`Active`) instead of the key (`active`)
- Template columns export plain text (HTML tags stripped)

### Custom export class

[](#custom-export-class)

Pass any `maatwebsite/excel` export class. Its constructor must accept `$query` and `$columns`:

```
use Aler998\Flux\Exports\FluxExport;
use Maatwebsite\Excel\Concerns\WithTitle;

class UsersExport extends FluxExport implements WithTitle
{
    public function title(): string
    {
        return 'Users';
    }
}
```

```
Table::make(User::class)
    ->columns([...])
    ->exportClass(UsersExport::class)
    ->render();
```

Internal Endpoints
------------------

[](#internal-endpoints)

MethodURLDescription`GET``/flux/table/{id}/data`Paginated JSON data`GET``/flux/table/{id}/export`Excel file downloadThe `/flux` prefix is configurable via `config('flux.route_prefix')`.

Building Assets
---------------

[](#building-assets)

If you need to rebuild the frontend assets (after modifying the source):

```
cd vendor/aler998/laravel-flux
npm install && npm run build
php artisan vendor:publish --tag=flux-assets --force
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f67bca08ffd8d2ee2f21c9d62e155776a243882c90476eacde1e1e99537be4e?d=identicon)[Aler](/maintainers/Aler)

---

Top Contributors

[![Aler998](https://avatars.githubusercontent.com/u/76817376?v=4)](https://github.com/Aler998 "Aler998 (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aler998-laravel-flux/health.svg)

```
[![Health](https://phpackages.com/badges/aler998-laravel-flux/health.svg)](https://phpackages.com/packages/aler998-laravel-flux)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1225.0k10](/packages/fleetbase-core-api)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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