Download the PHP package yajra/laravel-datatables-export without Composer
On this page you can find all versions of the php package yajra/laravel-datatables-export. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-datatables-export
Laravel DataTables Export Plugin
This package is a plugin of Laravel DataTables for handling server-side exporting using Queue and OpenSpout, with optional Livewire and DataTables button integrations.
Requirements
- PHP >=8.3 (OpenSpout 5.x, if installed, requires PHP 8.4+)
- Laravel 13
- Laravel Livewire (optional)
- OpenSpout
- Laravel DataTables 13.x
- jQuery DataTables 2.x
Documentations
Laravel Version Compatibility
| Laravel | Package |
|---|---|
| 8.x | 0.x |
| 9.x | 1.x |
| 10.x | 10.x |
| 11.x | 11.x |
| 12.x | 12.x |
| 13.x | 13.x |
Quick Installation
The package also requires batch job:
Configuration and Assets (Optional)
Usage
DataTables Button (No Livewire)
Publish the package assets and include the queued export button script after jQuery, DataTables, and DataTables Buttons:
Add WithExportQueue to the DataTable service and configure the button with the existing HTML builder:
The button sends the table's current search, ordering, and filter parameters, displays export progress, polls the queued batch, and downloads the completed file. Supported options are exportType, filename, sheetName, emailTo, autoDownload, pollInterval, processingText, and errorText.
JavaScript callbacks can be supplied as onStart, onProgress, onSuccess, and onError. The table element also dispatches datatables-export:start, datatables-export:progress, datatables-export:success, and datatables-export:error events:
Applications may listen for the server-side ExportStarted, ExportCompleted, and ExportFailed events to add notifications, broadcasting, or archival workflows. Broadcasting is optional and can use an application's own authenticated private channels.
Status and download URLs use encrypted access tokens. Their lifetime defaults to 1,440 minutes and can be changed with the token_ttl option in datatables-export.php.
Livewire Button
Install Livewire when using the Livewire component:
-
Add the export-button livewire component on your view file that uses dataTable class.
-
On your
DataTableclass, useWithExportQueue - Run your queue worker. Ex:
php artisan queue:work
Purging exported files
On app\Console\Kernel.php, register the purge command
Export Filename
You can set the export filename by setting the property.
Export Button Name
You can set the export button name by setting the buttonName property.
Export Type
You can set the export type by setting the property to csv or xlsx. Default value is xlsx.
Set Excel Sheet Name
Option 1: You can set the Excel sheet name by setting the property.
Option 2: You can also set the Excel sheet name by overwriting the method.
Formatting Columns
You can format the column by setting it via Column definition on you DataTable service class.
The format above will treat mobile numbers as text with leading zeroes.
Numeric Fields Formatting
The package will auto-detect numeric fields and can be used with custom formats.
Date Fields Formatting
The package will auto-detect date fields when used with a valid format or is a DateTime instance.
Valid Date Formats
Valid date formats can be adjusted on datatables-export.php config file.
Force Numeric Field As Text Format
Option to force auto-detected numeric value as text format.
Auto Download
Option to automatically download the exported file.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-datatables-export with dependencies
ext-json Version *
openspout/openspout Version ^4.24.5 || ^5.0
phpoffice/phpspreadsheet Version ^5.8.1
yajra/laravel-datatables-buttons Version ^13.0.2