Using Lazy Collections on memory-hungry operations in Laravel 6
September 4, 2019 — Laravel team has recently released v6.0
of the framework and with this they have added a bunch of exciting new features. Among which, I’m going to talk about Lazy Collections in this article. In Laravel, Illuminate\Support\Collection
class provides a fluent, convenient wrapper for working with arrays of data. In face, all the Eloquent queries are always returned as Collection
instances. LazyCollection
essentially extends the features of the Collection
class. Let’s talk about them in detail.