🦉 Fast Excel import/export for Laravel
MIT License
Published by rap2hpoutre about 5 years ago
Export rows one by one on large dataset to avoid memory_limit
problem, thanks to generators (using yield
and yield from
).
function usersGenerator() {
yield from User::chunk(200, function($users) {
foreach($users as $user) {
yield $user;
}
});
}
// Export consumes only a few MB, even with 10M+ rows.
(new FastExcel(usersGenerator()))->export('test.xlsx');
Published by rap2hpoutre about 6 years ago