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
Laravel Datatables Export

Laravel Datatables Export Laravel Package

yajra/laravel-datatables-export

Laravel DataTables Export is a plugin for yajra/laravel-datatables that enables server-side exports via queues and OpenSpout, with optional Livewire and DataTables button integrations. Requires PHP 8.3+ and Laravel 13. Install via Composer, run queue:batches-table and migrate, then publish assets fo...

View on GitHub
Deep Wiki
Context7

yajra/laravel-datatables-export is a plugin for Laravel DataTables that handles server-side exports using queued jobs and OpenSpout, keeping large exports out of the request cycle. It includes optional Livewire and DataTables Button integrations.

  • Queue-based exports for large datasets
  • OpenSpout-powered spreadsheet output
  • Optional Livewire integration
  • DataTables Button support without Livewire
  • Publishable configuration and assets; requires Laravel 13.x and PHP 8.3+
Frequently asked questions about Laravel Datatables Export
How do I add an export button to my existing Laravel DataTables view?
Use the `<livewire:export-button>` component in your Blade view, passing the DataTable’s ID via `:table-id`. Ensure your DataTable class extends `WithExportQueue` to enable queued exports. Example: `<livewire:export-button :table-id="$dataTable->getTableId()"/>`.
What Laravel and PHP versions does this package support?
This package requires **Laravel 13.x** and **PHP 8.3+** (PHP 8.4+ for OpenSpout 5.x). If you’re on Laravel 10/11, you’ll need to upgrade to Laravel 13. Check the [compatibility table](https://github.com/yajra/laravel-datatables-export) for older versions.
Do I need Livewire for exports? What if I don’t use Livewire?
Yes, this package **requires Livewire** for the export button component. If you’re not using Livewire, you’ll need to create a custom Blade component or AJAX endpoint to trigger exports via a controller, bypassing the Livewire dependency.
How do I handle large datasets (e.g., 50K+ rows) without memory issues?
The package uses **OpenSpout** for efficient streaming exports and **queued jobs** to avoid blocking requests. For very large datasets, configure chunking in your query (e.g., `->chunk(1000)`) and ensure your queue worker has sufficient memory. Monitor disk space if storing files locally.
What queue drivers are supported, and how do I set up workers?
Supported drivers include **Redis, database, and SQS**. Run `php artisan queue:work` to start workers. For high-volume exports, use Redis or a dedicated queue service. Ensure the `queue:batches-table` migration is run (`php artisan queue:batches-table && php artisan migrate`).
Can I export to formats other than CSV/XLSX, or is it limited to OpenSpout?
This package **only supports CSV and XLSX** via OpenSpout. If you need PDFs or other formats, consider integrating a separate library like **Barryvdh/Laravel-Snappy** or **Dompdf** alongside this package for hybrid workflows.
How do I store exported files on S3 instead of local disk?
Configure the `tmp_path` in `config/datatables-export.php` to point to an S3-compatible storage disk (e.g., `tmp_path => 's3://your-bucket/exports'`). Ensure your storage driver is properly set up in `config/filesystems.php` and the IAM role has write permissions.
What happens if the queue fails during an export? Can I retry or fallback to sync?
Failed jobs are retried automatically by Laravel’s queue system. For critical exports, implement a **fallback sync method** by extending the `ExportQueue` class or using a middleware to catch failures. Log errors via `Log::error()` for debugging.
How do I notify users when their export is ready (e.g., email or Livewire toast)?
Use Livewire’s `emit()` to show a toast notification when the export job completes. For emails, dispatch a `Mailable` in the job’s `handle()` method. Example: `ExportJob::dispatch($dataTable)->onQueue('exports');` then listen for job completion in Livewire.
Are there performance benchmarks for complex queries (e.g., joins, aggregations)?
Performance depends on your database and query complexity. Test with your actual data using `tntsearch/laravel-scout-tnt` for large datasets or optimize queries with indexes. For joins, consider denormalizing or caching results if exports run frequently.
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.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package