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 Html

Laravel Datatables Html Laravel Package

yajra/laravel-datatables-html

Laravel DataTables HTML plugin for Laravel: build DataTables markup and initialization scripts in PHP, with Laravel 12+ support and Vite-friendly module output. Works with yajra/laravel-datatables to streamline table configuration and rendering.

View on GitHub
Deep Wiki
Context7

Laravel DataTables HTML Builder Plugin

Frequently asked questions about Laravel Datatables Html
How do I integrate this package with Laravel 12+ for server-side DataTables?
Install via Composer (`composer require yajra/laravel-datatables-html:^13`), then use `DataTables::of(YourModel::query())->html()` in your controller. The package handles server-side processing with Eloquent, eliminating client-side bottlenecks for large datasets.
Does this work with Livewire for real-time updates?
Yes. Call `Builder::useLivewire()` in your `AppServiceProvider` and use `Builder::of(YourModel::query())->livewire()` in your Livewire component. This enables features like search-as-you-type without page reloads.
How do I configure Vite asset handling for DataTables?
Set `Builder::useVite()` in your `AppServiceProvider` to output ES modules. Ensure your Vite config includes DataTables JS from npm (`@datatables.net`). The package generates Vite-compatible script tags automatically.
What Laravel versions are officially supported?
The package supports Laravel 8–13, with version-specific branches (e.g., `^13` for Laravel 12/13). Check the [compatibility table](https://github.com/yajra/laravel-datatables-html#laravel-version-compatibility) to match your LTS version.
Can I customize column visibility based on user roles?
Yes. Use `visibleIf()` with Laravel’s gates or policies, e.g., `->column('salary', 'Salary')->visibleIfCan('view_salary')`. This integrates seamlessly with Laravel’s authorization system.
How do I handle large datasets (e.g., 50K+ records) efficiently?
Optimize with Laravel’s query caching (`->remember()`) or database indexing. For extreme cases, use `->select()` to limit loaded columns. The package streams data server-side, but complex queries may need profiling.
What if I need custom DataTables plugins (e.g., row grouping)?
Use `addScript()` or `addScriptIfCannot()` to load custom JS. For advanced plugins, ensure compatibility with your Vite/Livewire setup. The package’s fluent API lets you inject any DataTables initialization code.
Is there a Blade directive for quick table rendering?
Yes. Use `@datatables.table(['table' => 'users'])` in your Blade views. This shortcut generates the full HTML/JS markup, but you can also use `Builder::table()` in PHP for more control.
How do I avoid duplicate script loading in production?
Use `Builder::addScriptIfCannot()` to conditionally load scripts. For Vite, ensure DataTables is only imported once in your entry file. The package checks for existing scripts by default.
What are the alternatives if I need RTL or multi-language support?
The package supports DataTables’ built-in JS i18n (e.g., `Builder::language('ar')`). For RTL, use DataTables’ RTL CSS and override Blade templates with `getTemplate()`. Localization is handled via JS, not PHP.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony