ghostwriter / collection
Provides a Collection implementation for PHP
Fund package maintenance!
ghostwriter
Installs: 1 734 059
Dependents: 8
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.3
Requires (Dev)
- ghostwriter/coding-standard: dev-main
- ghostwriter/psalm-plugin: >=0.2
README
Provides a Collection implementation for PHP.
Installation
You can install the package via composer:
composer require ghostwriter/collection
Star ⭐️ this repo if you find it useful
You can also star (🌟) this repo to find it easier later.
Usage
/** @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]
Credits
Thank you
Thank you for freely sharing your knowledge, insight and free time with me. I am grateful for your help and support.
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
License
Please see LICENSE for more information on the license that applies to this project.
Security
Please see SECURITY.md for more information on security disclosure process.