Weave Code
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
Laravel Datatables

Laravel Datatables Laravel Package

yajra/laravel-datatables

Complete Laravel DataTables installer bundling core plus plugins. Supports Laravel 13 and PHP 8.3+, built for DataTables 2.x with Editor, Buttons, and Select extensions. Includes docs and version compatibility guidance for Laravel 8–13.

View on GitHub
Deep Wiki
Context7

Laravel DataTables Complete Package.

Frequently asked questions about Laravel Datatables
How do I install yajra/laravel-datatables in Laravel 13?
Run `composer require yajra/laravel-datatables:^13` to install the package. Laravel 13+ auto-discovers the service provider, so no manual registration is needed in `config/app.php`. The package bundles DataTables 2.x core and plugins (Buttons, Select, Editor) for immediate use.
Does this package support DataTables Editor 2.x for inline CRUD operations?
Yes, the package includes optional integration for DataTables Editor 2.x. After installing, configure the Editor extension in your JavaScript and use `DataTables::of()->editColumn()` to define editable fields. The backend handles server-side validation and updates via Laravel’s Eloquent or Query Builder.
Can I use this with Livewire or Inertia.js instead of Blade?
Absolutely. The package exposes RESTful JSON endpoints, so you can consume them in Livewire (via `$this->emit()` or properties) or Inertia.js (by fetching the endpoint directly). The frontend dependency (DataTables 2.x) remains the same, but the backend logic is framework-agnostic.
What Laravel versions does yajra/laravel-datatables support?
The package follows Laravel’s versioning strictly: `^13` is for Laravel 13.x only. For Laravel 11/12, use `^11` or `^12` respectively. Check the [compatibility table](https://github.com/yajra/datatables#laravel-version-compatibility) to avoid breaking changes during upgrades.
How do I optimize performance for large datasets (e.g., 100K+ rows)?
Server-side processing handles pagination/sorting/filtering efficiently, but optimize queries with indexing, `select()` clauses, and Eloquent scopes. For extreme cases, cache query results using Laravel’s cache drivers (e.g., `DataTables::of()->cache(60)`). Avoid `SELECT *` and use database-level optimizations like composite indexes.
Is there a way to customize the JSON response structure before sending it to DataTables?
Yes, use the `preQuery` and `postProcess` hooks in the `DataTables` facade. For example, `DataTables::of($query)->preQuery(function($query) { ... })` modifies the query, while `postProcess` lets you alter the final JSON array. Hooks are documented in the [Laravel DataTables API](http://yajrabox.com/docs/laravel-datatables).
Can I use this package with PostgreSQL or SQLite instead of MySQL?
Yes, the package is database-agnostic and works with PostgreSQL, SQLite, and others via Laravel’s Query Builder. No additional configuration is needed—server-side processing adapts to your database schema. Test edge cases like JSON columns or custom data types in your queries.
What are the risks of migrating from a custom DataTables implementation to this package?
The main risks are frontend dependency changes (DataTables 2.x) and backend logic adjustments if you relied on custom server-side processing. Audit your existing code for hardcoded queries or non-standard JSON responses. The package’s `DataTables::of()` method provides flexibility to replicate old behavior.
How do I add bulk actions (e.g., delete selected rows) using the Buttons extension?
Configure the Buttons extension in your DataTables initialization with `buttons: ['deleteSelected']`. On the backend, capture the selected IDs via `DataTables::of()->getSelected()` and process them in a controller. Example: `DataTables::of(User::query())->buttons(['deleteSelected'])->editColumn('action', '...');`
Does this package work with Laravel’s first-party testing tools (Pest or PHPUnit)?
Yes, test server-side logic by mocking the `DataTables` facade. For example, in PHPUnit: `$this->partialMock(DataTables::class, ['of'])->expects($this->once())->method('of')->willReturnSelf();`. Test JSON responses with `assertJson()` and validate pagination/sorting behavior. Frontend tests require DataTables 2.x in your test environment.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai