PHPackages                             appertly/hcollection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. appertly/hcollection

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

appertly/hcollection
====================

API-compatible Hack collections in PHP

1.0.0(9y ago)23501BSD-3-ClausePHPPHP &gt;=7.1

Since Feb 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/appertly/hcollection)[ Packagist](https://packagist.org/packages/appertly/hcollection)[ Docs](https://github.com/appertly/hcollection)[ RSS](/packages/appertly-hcollection/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

hcollection
===========

[](#hcollection)

This library can be used by projects which either wish to use an API compatible with Hack collections, or by projects which are being converted from Hack into PHP. It should basically be a drop-in replacement.

[![Packagist](https://camo.githubusercontent.com/00866c0a6f413721277175921a411fb299360bca9dd0e19099d70cbc504e2917/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6170706572746c792f68636f6c6c656374696f6e2e737667)](https://packagist.org/packages/appertly/hcollection)

Installation
------------

[](#installation)

You can install this library using Composer:

```
$ composer require appertly/hcollection
```

- The master branch (version 1.x) of this project requires PHP 7.1 and has no dependencies.

Compliance
----------

[](#compliance)

Releases of this library will conform to [Semantic Versioning](http://semver.org).

Our code is intended to *mostly* comply with [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/). If you find any issues related to standards compliance, please send a pull request!

License
-------

[](#license)

Just like the upstream Hack project, this project is licensed under the 3-clause BSD license.

Gotchas
-------

[](#gotchas)

As of PHP 7.1, the name `iterable` is now a reserved word. This causes problems with the `HH\Iterable` interface. In this library, this interface has been renamed to `HH\HackIterable`.

We have also added `JsonSerializable` to all concrete classes.

Since PHP wouldn't be able to support curly-brace instantiation, (e.g. `Vector{1,2,3}`), we instead added a (Google Guava-style) static `of` method to all the concrete classes:

```
use HH\ImmMap;
use HH\ImmVector;

$map = ImmMap::of(); // would be empty
$vector = ImmVector::of(); // would be empty
$map = ImmMap::of('key1', 'value1', 'key2', 'value2', 'key3'); // value3 would be null
$vector = ImmVector::of(1, 2, 3);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3380d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/659262eac941ffe4795493834425fc9a2369c2c9df3cc565ed4194f1d37be934?d=identicon)[doublecompile](/maintainers/doublecompile)

---

Top Contributors

[![doublecompile](https://avatars.githubusercontent.com/u/4267230?v=4)](https://github.com/doublecompile "doublecompile (2 commits)")

---

Tags

collectioncollectionshackhacklang

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/appertly-hcollection/health.svg)

```
[![Health](https://phpackages.com/badges/appertly-hcollection/health.svg)](https://phpackages.com/packages/appertly-hcollection)
```

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[vistik/typed-collections

A simple way to create typed collections in PHP - build on Illuminate\\Support\\Collection

1128.2k5](/packages/vistik-typed-collections)[rotexsoft/versatile-collections

A collection package that can be extended to implement things such as a Dependency Injection Container, RecordSet objects for housing database records, a bag of http cookies, or technically any collection of items that can be looped over and whose items can each be accessed using array-access syntax or object property syntax.

186.0k1](/packages/rotexsoft-versatile-collections)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
