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

waylandace/datatables-bundle

A Laravel bundle for integrating DataTables into PHP applications, offering reusable table configuration and server-side processing to help developers add interactive, searchable data grids quickly.

View on GitHub
Deep Wiki
Context7

Getting Started

First, the framework mismatch. waylandace/datatables-bundle is a Symfony bundle, not a Laravel package. There is no service provider, no facade, no config/datatables.php published via vendor:publish. You cannot composer require it into a Laravel app and use it as-is — it registers itself through Symfony's kernel/bundle mechanism and expects Symfony's DI container, Twig, and typically Doctrine. If your day-to-day is Laravel, the practical leverage here is conceptual, not direct: treat it as a reference implementation of server-side DataTables and use yajra/laravel-datatables instead.

If you are in a Symfony app:

  1. composer require waylandace/datatables-bundle
  2. With Symfony Flex, the bundle should auto-register in config/bundles.php; otherwise add WaylandAce\DataTablesBundle\DataTablesBundle::class => ['all' => true].
  3. Look first at, in this order:
    • README.md and any docs/ — for the table-class contract and AJAX route expectations.
    • src/DependencyInjection/ — for the config tree (default options, template paths, service IDs).
    • src/Resources/config/ — for the services you can inject or override.
    • The base DataTable/AbstractDataTable class — this is the extension point you subclass per entity.

First use case: an admin listing page for a Doctrine entity with server-side pagination, global search, and per-column ordering. You define a table class for the entity, point a controller action at it to serve the JSON, and render the table in Twig. Verify the exact method names in vendor/waylandace/datatables-bundle/ before writing anything — this package has 0 stars, 0 dependents, and its last release was 2020-08-28, so there is effectively no community documentation or Stack Overflow coverage to fall back on.

Implementation Patterns

One table class per entity. The core pattern in bundles of this shape is a subclass that declares columns and the base query. Expect something like:

class UserTable extends AbstractDataTable
{
    public function getQueryBuilder(): QueryBuilder { /* ... */ }

    public function configure(DataTable $table): void
    {
        $table->addColumn('id');
        $table->addColumn('email');
        $table->addColumn('createdAt', 'created_at');
    }
}

Register it as a service (autowiring) and inject it into the controller.

Two-endpoint workflow. Typically the controller renders the page and a second action returns the JSON payload. Keep them separate:

#[Route('/admin/users', name: 'admin_users')]
public function index(): Response { return $this->render('admin/users.html.twig'); }

#[Route('/admin/users/data', name: 'admin_users_data')]
public function data(UserTable $table): JsonResponse { return $table->getResponse(); }

The JSON must conform to the DataTables contract — draw, recordsTotal, recordsFiltered, data — and draw must echo the request's draw parameter. If the bundle handles this for you, confirm it does; if not, build it explicitly.

Column mapping is the real work. Separate the display name from the query column. Aliased/joined fields (createdAt → u.created_at) are where most bugs live. Do the mapping once, in the table class, and let search/order reuse it.

Twig integration. The bundle likely ships a Twig extension or template partial that emits the <table> and the JS init. Override the template via bundle inheritance (templates/bundles/DataTablesBundle/...) rather than editing vendor files, so upgrades (such as they are) don't clobber your changes.

Repository hygiene. Push query construction into a repository method and keep the table class thin — column config, filter mapping, one call to the repo. This keeps the table testable and lets you reuse the query elsewhere.

Gotchas and Tips

Maturity is the headline risk. Zero stars, zero dependents, a single release from August 2020. No security advisories will be filed against it, no one will answer issues, and any incompatibility with modern Symfony (6/7) or PHP 8.2+ is yours to fix. Before adopting, read composer.json for symfony/* and php constraints and test the install in a throwaway branch. If it doesn't resolve cleanly, fork and patch — don't fight the constraint solver.

Check for abandoned-transitive-dependency risk. A 2020 bundle may pin an old doctrine/dbal or symfony/http-foundation range that conflicts with your app. composer why-not on the bundle's key requirements will tell you fast.

Draw counter mismatches. If the table "spins forever" or pagination desyncs, the usual cause is a missing or non-integer draw in the JSON response — DataTables silently discards responses it can't correlate. Log the raw response and compare against the request payload.

Column index drift. DataTables sends ordering/search by index, not name. If you add or reorder columns in the Twig/JS config without updating the server-side column map, sorting will target the wrong field — often with no error, just wrong results. Keep the map in one place and derive both sides from it.

CSRF on the AJAX route. DataTables defaults to GET for the data request. If you switch to POST and your app enforces CSRF on POST, you'll get 419/403s. Either keep the data route GET (read-only, safe) or inject the token into the JS and send it in a header.

Debugging approach: dump() the incoming request parameters and the outgoing array in the data action; the mismatch is almost always in the parameter handling, not the query. Enable Doctrine SQL logging to confirm the LIMIT/OFFSET and ORDER BY actually applied.

Extension points to prefer: subclass the base table class, override templates via bundle inheritance, and decorate services in services.yaml rather than editing vendor/. Given the package's age, assume you will need a fork; keep your overrides in one directory so the diff is manageable.

The Laravel takeaway: if you're porting the pattern, the moving parts are identical — a per-resource table class, a JSON endpoint, a column map, and the draw/recordsTotal/recordsFiltered envelope. yajra/laravel-datatables implements exactly this and is actively maintained; study this bundle's column-mapping approach, then implement it there rather than pulling Symfony into a Laravel project.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle