- How do I install yajra/laravel-datatables-oracle in Laravel?
- Install it with composer require yajra/laravel-datatables-oracle. Laravel 5.5 and later use package auto-discovery, so no manual service provider registration is normally needed. Optionally publish the config with php artisan vendor:publish --tag=datatables if you need to override defaults. For the v13 line, confirm your app meets PHP 8.3+ and Laravel 12 or 13 before installing.
- Which Laravel and PHP versions does yajra/laravel-datatables support?
- The v13 line requires PHP 8.3 or newer and Laravel 12 or 13. The package major version tracks the Laravel major version, so older applications are pinned to ^12 or earlier and should be treated as a separate upgrade track. Plan for a package upgrade alongside every Laravel major upgrade.
- What is the difference between DataTables::eloquent(), DataTables::query(), and DataTables::collection()?
- Use DataTables::eloquent() for Eloquent models where you want relationships, scopes, and model events. Use DataTables::query() with the fluent query builder for high-volume reporting or complex joins where raw query control matters. Use DataTables::collection() for bounded, computed, or non-database datasets, since it loads data into memory before filtering and paging.
- Does yajra/laravel-datatables handle filtering, sorting, and pagination automatically?
- Yes. The package reads the DataTables AJAX payload (draw, start, length, search, order, and columns) and applies filtering, sorting, and pagination before returning the expected JSON envelope. You define the base query or collection and column mappings, and the package manages the request-driven behavior. It does not replace your application's authorization or validation logic.
- How do I secure column names and ordering in yajra/laravel-datatables?
- Treat column names and order clauses from the browser as untrusted input and never pass raw request keys into the query builder. Use an explicit allowlist for searchable and orderable columns, enforce per-column authorization in your controller or policy layer, and pin patch versions of the package. Recent releases hardened this area, including an allowlist for column validation in 13.1.1 and a fix for SQL injection in orderByNullsLast in 13.1.0, but the package should still be treated as security-sensitive.
- Can I use yajra/laravel-datatables with Eloquent relationships and eager loading?
- The Eloquent driver supports eager loading with with() and can search and sort related columns when you define them explicitly in the column configuration. Deep joins and complex relation filtering can become harder to express and may perform better with the query builder driver. Choose the driver per screen based on join depth and expected row counts.
- Does yajra/laravel-datatables support inline editing and row CRUD?
- No. The MIT-licensed core package handles read-only server-side processing and returns JSON for display. Inline editing and row CRUD require DataTables Editor, which is a separate commercial license and a procurement decision rather than a Composer dependency. Keep editing out of scope unless that license and budget are approved.
- How do I test a DataTables endpoint built with yajra/laravel-datatables?
- Write feature tests that call your DataTables route with the AJAX parameters the frontend would send, including draw, start, length, columns, search, and order. Assert the JSON envelope contains draw, recordsTotal, recordsFiltered, and data, and add cases for filtering, sorting, and unauthorized access. Use RefreshDatabase and seeded fixtures so pagination and search assertions are deterministic.
- Is yajra/laravel-datatables a good fit for APIs or SPAs, and what alternatives should I consider?
- It is a poor fit for API-first applications, SPAs, mobile clients, or Livewire and Inertia screens that need a typed JSON contract independent of the DataTables request schema. It fits classic Laravel MVC with Blade and jQuery DataTables, especially internal admin and back-office tooling. If you need a different frontend contract, consider building explicit API resources or using a table component that does not depend on DataTables AJAX parameters rather than forcing this package into that role.
- Who maintains yajra/laravel-datatables and what are the production risks?
- The package is effectively maintained by a single primary maintainer with an informal Gitter support channel and no vendor SLA, though it has healthy adoption at roughly 4.9k GitHub stars. The MIT license covers the core, but production use should include pinned patch versions, routine security review, and a dependency-graph check because the reported dependents signal is anomalous due to the meta-package split. Budget for package upgrades in lockstep with Laravel majors.