Hello, at the start of the year I posted about my collection library here ( previous post ), the reception and feedback was great, and I promised to add lazy pipelines (Sequence) by the end of the year.
Finally, it's here in 0.2, but it wasn't made by me.. nikophil (one of the maintainers of zenstruck/foundry ) found the library and offered to build it - and did a great job (with some perf improvements on top), I just reviewed the code, so big thanks for that!
GitHub: https://github.com/noctud/collection
Sequence docs: https://noctud.dev/collection/sequence
Quick recap if you missed the first post
It's not just a nicer API over arrays, it also fixes the array quirks:
Keys stay what they are - "1" stays string, true stays bool, and objects work as keys
Mutable and immutable List, Set and Map - immutable methods are #[NoDiscard]
Full generics, PHPStan level 9 - the element type flows through the whole chain
Live map views - $map->keys, $map->values and $map->entries are real collections sharing memory…