Menu

noctud/collection v0.2 released (Kotlin-style List/Set/Map for PHP), now with lazy pipelines

#php#redditr#no#sequence#line
Reading 0:00
15s threshold

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…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.