Streaming export with cursor() keeps memory flat, but touching a model's relations inside the export triggers N+1 — thousands of extra queries. Here is why cursor() cannot help with relations and how to export them through lazy() without giving up the memory savings.
Importing Excel into Eloquent models usually turns into a loop that picks cells apart by hand. Here is how withHeadings() and mapping() cut it down to a few lines, and how to bind “foreign” columns of a file to your model's attributes without guesswork.
Laravel Excel runs out of memory on a large export not because of your code but because of PhpSpreadsheet's architecture. Here is why chunking does not save you, and how streaming export through cursor() keeps memory flat.
Generating Excel in PHP looks like a simple task — right up until the file grows to hundreds of thousands of rows and the script hits its memory limit or dies on a timeout. This is an article about the philosophy of FastExcelPhp and the problems this family of libraries solves.
Why do you need FastExcelWriter when the excellent PhpSpreadsheet already exists? Because it is simply better — faster, leaner and more concise.