Collect - Illuminate Collections
Import Laravel's Collections into non-Laravel packages easily, without needing to require the entire
Illuminate\Support package. (Why not pull
Illuminate\Support in framework-agnostic packages)
Written by Taylor Otwell as a part of Laravel's Illuminate/Support package, Collect is just the code from Support needed in order to use Collections on their own.
composer require tightenco/collect
- Will this develop independently from Illuminate's Collections?
No. Right now it's split manually, but the goal is for it shortly to be split automatically to keep it in sync with Laravel's Collections, even mirroring the release numbers.
- Why is the package
It's not an official Laravel package so we don't want to use the Packagist namespace reserved by Laravel packages. One day
Collectionmay be extracted from
illuminate/supportto a new package. If so, we'll deprecate this package and point to the core version.
- Why not just use an array?
What a great question. Tighten alum Adam Wathan has a book about that.
The Laravel framework is open-sourced software licensed under the MIT license. Collect consists almost entirely of Laravel source code, so maintains the same license.