A collection library offering immutable collections.
Collections implement \HypnoTox\Pack\CollectionInterface which extends \IteratorAggregate, \ArrayAccess and \Countable and adds other chainable methods.
This is just a personal project, but follows semantic versioning and will be stable once reaching its first major release.
PRs are welcome.
Simply require it using composer: composer require hypnotox/pack
Currently, the only implemented collection is \HypnoTox\Pack\ArrayCollection.
Everything is type-hinted with generic template expressions to allow for full typing using static analysis.
$collection = new \HypnoTox\Pack\ArrayCollection([1, 2, 3]);
$collection->first()->key; // 0
$collection->first()->value; // 1
$collection->set(0, 100)->first()->value; // 100// TODO