Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Datatables Bundle Laravel Package

fluxter/datatables-bundle

Fluxter DataTables Bundle integrates DataTables with Symfony, enabling server-side searching, sorting, filtering, and pagination for interactive data grids. It simplifies building admin tables and CRUD lists with minimal setup and clean integration.

View on GitHub
Deep Wiki
Context7

Getting Started

Reality check first: fluxter/datatables-bundle is a Symfony bundle, not a Laravel package. There is no service provider, no config/datatables.php, and no Eloquent adapter. Treat this assessment as "can I borrow the architecture?" rather than "can I composer require it into my Laravel app?" — because you can't, cleanly. If what you actually want is server-side DataTables on Laravel, yajra/laravel-datatables is the native answer; read the rest of this as a comparison and a porting guide.

Minimal steps if you're evaluating it inside a Symfony context (or a Laravel app with a Symfony-flavored component):

  1. composer require fluxter/datatables-bundle
  2. Register the bundle in config/bundles.php (Symfony 4+) — there is no auto-discovery for old-style bundles.
  3. Check the repo for Resources/config/ or config/ for routing/service definitions you must import manually.
  4. Read the tests/ directory before the README. With 0 stars and 0 dependents, the test suite is the only reliable specification of the public API.

Where to look first:

  • The Datatable base class (the abstract you subclass per resource).
  • The Column definition object (name, field, searchable, orderable, render).
  • The Adapter layer (Doctrine ORM query builder → rows). This is the piece you'd rewrite for Eloquent.

First use case: one admin index page — say an orders list — with server-side pagination, one global search box, sortable columns for id, created_at, total, and an "actions" column that renders links. That single page exercises every part of the bundle you'll care about.

Implementation Patterns

One Datatable class per resource. The idiomatic shape is a subclass that declares columns and a data source, then a thin controller that delegates. Something like:

class OrdersDatatable extends AbstractDatatable
{
    public function configure(DataTable $table): void
    {
        $table->add('id', 'o.id', ['orderable' => true]);
        $table->add('customer', 'c.name', ['searchable' => true]);
        $table->add('total', 'o.total');
        $table->add('created_at', 'o.createdAt');
    }
}

Register it as a tagged service, inject the factory into the controller, then:

$datatable = $this->datatableFactory->create(OrdersDatatable::class);
$datatable->handleRequest($request);

if ($datatable->isCallback()) {
    return $datatable->getResponse(); // JSON for DataTables
}
return $this->render('orders/index.html.twig', ['datatable' => $datatable]);

Adapter is the seam you customize. The bundle almost certainly ships a Doctrine ORM adapter (and possibly an array adapter for tests). Build a thin Eloquent adapter implementing the same contract if you're porting: it receives a builder, applies skip/take from start/length, applies orderBy per column, and applies where ... like for global search. Keep it under ~100 lines and it will pay for itself across every table in the app.

Reuse aggressively. Extract a BaseDatatable with common columns (id, created_at, an action column), and traits like HasStatusColumn, HasDateRangeFilter. Action columns should render via a route helper, not string concatenation — that's where XSS lives.

Frontend wiring must mirror the server exactly.

$('#orders').DataTable({
  serverSide: true,
  processing: true,
  ajax: { url: '/admin/orders/datatable', type: 'GET' },
  columns: [
    { data: 'id', name: 'o.id' },
    { data: 'customer', name: 'c.name' },
    { data: 'total', name: 'o.total' },
    { data: 'created_at', name: 'o.createdAt' },
    { data: 'actions', orderable: false, searchable: false },
  ],
});

The columns[].name values must line up with what the server declares, in order. This is the single most common source of "sorting works but sorts the wrong column."

Extra filters beyond DataTables' built-in search. Read custom query params (status, date range, tenant id) directly off the request inside the datatable class, and apply them to the builder before the adapter paginates. Do not try to smuggle them through the global search string.

Laravel translation table if you're porting concepts:

Bundle concept Laravel equivalent
Abstract Datatable subclass A DataTable service class, or yajra's DataTable + HtmlBuilder
Doctrine ORM adapter Eloquent/Query Builder adapter (yajra ships this)
Tagged service + factory Container binding / app() resolution
handleRequest ->make(true) on yajra
Column render callback addColumn() / editColumn()

Gotchas and Tips

The framework mismatch is the headline gotcha. No Laravel adapter, no service provider, no facade. Symfony bundles assume a kernel request/response lifecycle and Doctrine. You will spend more time shimming than you save unless you're porting a specific design you like. Budget for that honestly.

Zero adoption means zero institutional knowledge. 0 stars, 0 dependents, no StackOverflow trail. Pin an exact version in composer.json, and consider vendoring/forking the handful of classes you actually use so an upstream commit can't break you. The opportunity score is high precisely because nobody uses it — that's not a quality signal.

Whitelist column names. The adapter receives order[0][column] and columns[i][name] from the client. If those flow into DQL/SQL without a lookup against your declared columns, you have injection and information-disclosure (ordering by a column you didn't expose) in one bug. Resolve index → declared column object, never pass the raw string.

Count queries are where performance dies. Server-side DataTables needs a filtered total and an unfiltered total. Joined/grouped queries make the count wrong or slow. Test with realistic row counts; if recordsFiltered is ever larger than recordsTotal, your count query is broken.

Pagination length: -1 (the "All" option). Cap it server-side. A user clicking "All" on a 2M-row table should get a validation error, not a dead worker.

Searching joined columns. LIKE against c.name works, but searching o.total with LIKE casts numerics and kills the index. Mark numeric/date columns searchable => false and give them dedicated filter inputs instead.

N+1 on relation columns. If a column pulls order.customer.name lazily, you'll issue one query per row (times page size, times pagination clicks). Fetch-join or addSelect the alias — and be careful: fetch-joining a to-many relation while paginating corrupts your page boundaries unless you use Doctrine's Paginator.

Keep formatting on the client. Return raw values from the server and use DataTables' render for currency, dates, and badges. Formatting server-side makes sorting and searching inconsistent with what's displayed.

Debugging recipe: dump the final DQL/SQL the adapter builds (Doctrine's getSQL() or the query log). Then check the response envelope — DataTables expects { draw, recordsTotal, recordsFiltered, data }. A missing draw echo causes the table to discard the response and show stale data forever, which looks like a caching bug but isn't.

A silent failure mode to know: an exception thrown inside the JSON callback returns HTML (a Symfony error page or a Laravel 500 page) to DataTables, which reports only "Ajax error." Always wire the JS error callback to surface the response body during development.

Extension points worth using: the adapter (swap for Eloquent), column render callbacks (route generation, status pills), and a response transformer if you need to add metadata to the JSON envelope. If a requirement needs more than these three, you're fighting the library — reach for omines/datatables-bundle (far more adopted, same conceptual model) or yajra/laravel-datatables on Laravel, both of which you can actually get help with.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo