gitmyhub

Laravel-Excel

PHP ★ 13k updated 12d ago

🚀 Supercharged Excel exports and imports in Laravel

PHP package for Laravel that makes reading and writing Excel and CSV files straightforward, with built-in support for large datasets via chunking and background queue processing.

PHPLaravelPhpSpreadsheetsetup: moderatecomplexity 2/5

Laravel Excel is a PHP package that makes it straightforward to read and write Excel and CSV files inside a Laravel web application. Laravel is a popular PHP framework for building web applications, and this package slots into it cleanly, following Laravel's conventions so it feels like a natural part of the framework rather than an external add-on.

For exports, the package can take a collection of database records and write them directly to an Excel file that users can download. It handles large datasets by automatically splitting the work into smaller pieces (called chunks) so the server does not run out of memory when dealing with tens of thousands of rows. Exports can also be pushed to a background queue, meaning the file is generated asynchronously while the user continues using the application, rather than waiting for a potentially slow operation to complete. The README also mentions the ability to export a styled HTML table (created with Laravel's Blade template system) directly to Excel, for cases where layout matters.

For imports, the package reads Excel or CSV files and loads the data into database models. Like exports, large files can be read in chunks and processed via queued jobs running in the background, which prevents timeouts on big imports.

The package is built on top of PhpSpreadsheet, an underlying PHP library that handles the actual Excel file format. Laravel Excel acts as a wrapper that makes PhpSpreadsheet fit naturally into the Laravel way of doing things.

It is free to use under the MIT license. The authors describe it as "Postcardware," meaning they do not require payment but ask that anyone who uses it in a production application send a physical postcard to their office in the Netherlands. The package is maintained by Spartner, a Dutch software development company. Full documentation is hosted on a separate site rather than in the README itself.

Where it fits