If you've written PHP for any length of time, you've fought the array. It's a hash table, a list, a tuple, and an associative store all crammed into one type, and it silently casts your keys to whatever it feels like. Every serious project eventually reaches for something better. There are a few reasonable places to reach. I wrote one of the five libraries this post covers (noctud/collection). I've tried to be fair, including pointing you at the right library when it isn't mine. Weigh that as you read. The five contenders doctrine/collections. The collections layer underneath Doctrine ORM. Mature, stable, present as a transitive dependency in a huge chunk of the PHP ecosystem. illuminate/collections. Laravel's Collection class. Probably the most-installed PHP utility class that exists. Around 140 chainable helper methods, fluent API. loophp/collection. Pol Dellaiera's lazy collection library, built around generators. FP-style, immutable, strong static analysis story. noctud/collection.…