{"id":14063315,"url":"https://github.com/yajra/laravel-datatables-export","last_synced_at":"2025-04-04T10:09:01.927Z","repository":{"id":41385991,"uuid":"100144817","full_name":"yajra/laravel-datatables-export","owner":"yajra","description":"Laravel DataTables Export plugin that uses queue, spout and livewire for bulk data export.","archived":false,"fork":false,"pushed_at":"2024-10-09T13:26:35.000Z","size":137,"stargazers_count":30,"open_issues_count":2,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T00:43:39.369Z","etag":null,"topics":["datatables","export-excel","hacktoberfest","laravel","laravel-package","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yajra.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"yajra","patreon":"yajra","custom":"https://www.paypal.me/yajra"}},"created_at":"2017-08-13T00:37:10.000Z","updated_at":"2024-10-25T16:26:54.000Z","dependencies_parsed_at":"2023-02-19T13:31:02.193Z","dependency_job_id":"e2c154cf-352c-440a-8bd1-8e2d6ebec444","html_url":"https://github.com/yajra/laravel-datatables-export","commit_stats":{"total_commits":162,"total_committers":18,"mean_commits":9.0,"dds":0.2592592592592593,"last_synced_commit":"84f59c6acb55f6263fccf3fe2db8021db342a952"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-datatables-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-datatables-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-datatables-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yajra%2Flaravel-datatables-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yajra","download_url":"https://codeload.github.com/yajra/laravel-datatables-export/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datatables","export-excel","hacktoberfest","laravel","laravel-package","php"],"created_at":"2024-08-13T07:03:16.109Z","updated_at":"2025-04-04T10:09:01.902Z","avatar_url":"https://github.com/yajra.png","language":"PHP","funding_links":["https://github.com/sponsors/yajra","https://patreon.com/yajra","https://www.paypal.me/yajra"],"categories":["PHP"],"sub_categories":[],"readme":"# Laravel DataTables Export Plugin\n\n[![Laravel 12.x](https://img.shields.io/badge/Laravel-12.x-orange.svg)](http://laravel.com)\n[![Latest Stable Version](https://img.shields.io/packagist/v/yajra/laravel-datatables-export.svg)](https://packagist.org/packages/yajra/laravel-datatables-export)\n[![Continuous Integration](https://github.com/yajra/laravel-datatables-export/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/yajra/laravel-datatables-export/actions/workflows/continuous-integration.yml)\n[![Static Analysis](https://github.com/yajra/laravel-datatables-export/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/yajra/laravel-datatables-export/actions/workflows/static-analysis.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/yajra/laravel-datatables-export.svg)](https://packagist.org/packages/yajra/laravel-datatables-export)\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://packagist.org/packages/yajra/laravel-datatables-export)\n\nThis package is a plugin of [Laravel DataTables](https://github.com/yajra/laravel-datatables) for handling server-side\nexporting using Queue, OpenSpout and Livewire.\n\n## Requirements\n\n- [PHP \u003e=8.2](http://php.net/)\n- [Laravel 12](https://github.com/laravel/framework)\n- [Laravel Livewire](https://laravel-livewire.com/)\n- [OpenSpout](https://github.com/openspout/openspout/)\n- [Laravel DataTables 12.x](https://github.com/yajra/laravel-datatables)\n- [jQuery DataTables 2.x](http://datatables.net/)\n\n## Documentations\n\n- [Laravel DataTables Documentation](http://yajrabox.com/docs/laravel-datatables)\n\n## Laravel Version Compatibility\n\n| Laravel | Package |\n|:--------|:--------|\n| 8.x     | 0.x     |\n| 9.x     | 1.x     |\n| 10.x    | 10.x    |\n| 11.x    | 11.x    |\n| 12.x    | 12.x    |\n\n## Quick Installation\n\n```\ncomposer require yajra/laravel-datatables-export:\"^12.0\"\n```\n\nThe package also requires batch job:\n\n```shell\nphp artisan queue:batches-table\nphp artisan migrate\n```\n\n### Configuration and Assets (Optional)\n\n```\nphp artisan vendor:publish --tag=datatables-export --force\n```\n\n## Usage\n\n1. Add the export-button livewire component on your view file that uses dataTable class.\n\n```html\n\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\"/\u003e\n```\n\n2. On your `DataTable` class, use `WithExportQueue`\n\n```php\nuse Yajra\\DataTables\\WithExportQueue;\n\nclass PermissionsDataTable extends DataTable\n{\n    use WithExportQueue;\n    \n    ...\n}\n```\n\n3. Run your queue worker. Ex: `php artisan queue:work`\n\n## Purging exported files\n\nOn `app\\Console\\Kernel.php`, register the purge command\n\n```php\n$schedule-\u003ecommand('datatables:purge-export')-\u003eweekly();\n```\n\n## Export Filename\n\nYou can set the export filename by setting the property.\n\n```html\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" filename=\"my-table.xlsx\"/\u003e\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" filename=\"my-table.csv\"/\u003e\n\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" :filename=\"$filename\"/\u003e\n```\n\n## Export Button Name\n\nYou can set the export button name by setting the `buttonName` property.\n\n```html\n\u003c!-- Examples demonstrating how to customize the button name for different scenarios --\u003e\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" type=\"xlsx\" buttonName=\"Export Excel\"/\u003e\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" type=\"csv\"  buttonName=\"Export CSV\"/\u003e\n\n```\n\n## Export Type\n\nYou can set the export type by setting the property to `csv` or `xlsx`. Default value is `xlsx`.\n\n```html\n\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" type=\"xlsx\"/\u003e\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" type=\"csv\"/\u003e\n```\n\n## Set Excel Sheet Name\n\nOption 1: You can set the Excel sheet name by setting the property.\n\n```html\n\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" sheet-name=\"Monthly Report\"/\u003e\n```\n\nOption 2: You can also set the Excel sheet name by overwriting the method.\n\n```php\nprotected function sheetName() : string\n{\n    return \"Yearly Report\";\n}\n```\n\n## Formatting Columns\n\nYou can format the column by setting it via Column definition on you DataTable service class.\n\n```php\nColumn::make('mobile')-\u003eexportFormat('00000000000'),\n```\n\nThe format above will treat mobile numbers as text with leading zeroes.\n\n## Numeric Fields Formatting\n\nThe package will auto-detect numeric fields and can be used with custom formats.\n\n```php\nColumn::make('total')-\u003eexportFormat('0.00'),\nColumn::make('count')-\u003eexportFormat('#,##0'),\nColumn::make('average')-\u003eexportFormat('#,##0.00'),\n```\n\n## Date Fields Formatting\n\nThe package will auto-detect date fields when used with a valid format or is a DateTime instance.\n\n```php\nColumn::make('report_date')-\u003eexportFormat('mm/dd/yyyy'),\nColumn::make('created_at'),\nColumn::make('updated_at')-\u003eexportFormat(NumberFormat::FORMAT_DATE_DATETIME),\n```\n\n## Valid Date Formats\n\nValid date formats can be adjusted on `datatables-export.php` config file.\n\n```php\n    'date_formats' =\u003e [\n        'mm/dd/yyyy',\n        NumberFormat::FORMAT_DATE_DATETIME,\n        NumberFormat::FORMAT_DATE_YYYYMMDD,\n        NumberFormat::FORMAT_DATE_XLSX22,\n        NumberFormat::FORMAT_DATE_DDMMYYYY,\n        NumberFormat::FORMAT_DATE_DMMINUS,\n        NumberFormat::FORMAT_DATE_DMYMINUS,\n        NumberFormat::FORMAT_DATE_DMYSLASH,\n        NumberFormat::FORMAT_DATE_MYMINUS,\n        NumberFormat::FORMAT_DATE_TIME1,\n        NumberFormat::FORMAT_DATE_TIME2,\n        NumberFormat::FORMAT_DATE_TIME3,\n        NumberFormat::FORMAT_DATE_TIME4,\n        NumberFormat::FORMAT_DATE_TIME5,\n        NumberFormat::FORMAT_DATE_TIME6,\n        NumberFormat::FORMAT_DATE_TIME7,\n        NumberFormat::FORMAT_DATE_XLSX14,\n        NumberFormat::FORMAT_DATE_XLSX15,\n        NumberFormat::FORMAT_DATE_XLSX16,\n        NumberFormat::FORMAT_DATE_XLSX17,\n        NumberFormat::FORMAT_DATE_YYYYMMDD2,\n        NumberFormat::FORMAT_DATE_YYYYMMDDSLASH,\n    ]\n```\n\n## Force Numeric Field As Text Format\n\nOption to force auto-detected numeric value as text format.\n\n```php\nColumn::make('id')-\u003eexportFormat('@'),\nColumn::make('id')-\u003eexportFormat(NumberFormat::FORMAT_GENERAL),\nColumn::make('id')-\u003eexportFormat(NumberFormat::FORMAT_TEXT),\n```\n\n## Auto Download\n\nOption to automatically download the exported file.\n\n```html\n\n\u003clivewire:export-button :table-id=\"$dataTable-\u003egetTableId()\" filename=\"my-table.xlsx\" auto-download=\"true\"/\u003e\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/yajra/laravel-datatables-export/blob/master/.github/CONTRIBUTING.md) for\ndetails.\n\n## Security\n\nIf you discover any security related issues, please email [aqangeles@gmail.com](mailto:aqangeles@gmail.com) instead of\nusing the issue tracker.\n\n## Credits\n\n- [Arjay Angeles](https://github.com/yajra)\n- [All Contributors](https://github.com/yajra/laravel-datatables-export/graphs/contributors)\n- [Laravel Daily](https://github.com/LaravelDaily/Laravel-Excel-Export-Import-Large-Files)\n\n## License\n\nThe MIT License (MIT). Please\nsee [License File](https://github.com/yajra/laravel-datatables-export/blob/master/LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyajra%2Flaravel-datatables-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyajra%2Flaravel-datatables-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyajra%2Flaravel-datatables-export/lists"}