Provides a Collection implementation for PHP.
You can install the package via composer:
composer require ghostwriter/collection
You can also star (🌟) this repo to find it easier later.
/** @var \Ghostwriter\Collection\Collection $collection */
$collection = Collection::new([1, 2, 3])
->append([4, 5, 6, 7, 8, 9])
->map(static fn ($v): int => $v * 10)
->filter(static fn ($v): bool => 0 === $v % 20);
$collection->toArray(); // [20, 40, 60, 80]
$collection->drop(1) // [40, 60, 80]
->take(2) // [40, 60]
->slice(1, 1) // [60]
->toArray(); // [60]
Thank you for freely sharing your knowledge, insight and free time with me. I am grateful for your help and support.
Please see CHANGELOG.md for more information on what has changed recently.
Please see LICENSE for more information on the license that applies to this project.
Please see SECURITY.md for more information on security disclosure process.