hypnotox / pack
PHP package offering immutable collections.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/hypnotox/pack
Requires
- php: >=8.1
Requires (Dev)
- fakerphp/faker: ^1.19
- friendsofphp/php-cs-fixer: ^3.4
- phpbench/phpbench: ^1.2
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.15
README
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.
Installation
Simply require it using composer: composer require hypnotox/pack
Features
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.
Usage
ArrayCollection
$collection = new \HypnoTox\Pack\ArrayCollection([1, 2, 3]); $collection->first()->key; // 0 $collection->first()->value; // 1 $collection->set(0, 100)->first()->value; // 100
Collection Methods
// TODO