PHPackages                             hackphp/container - 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. hackphp/container

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

hackphp/container
=================

HackPHP PSR-11 compatible container

1.0(4y ago)00MITPHP

Since Aug 27Pushed 4y agoCompare

[ Source](https://github.com/hackphp/container)[ Packagist](https://packagist.org/packages/hackphp/container)[ RSS](/packages/hackphp-container/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

HackPHP Container
=================

[](#hackphp-container)

HackPHP dependency injection container.

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

[](#installation)

```
composer require hackphp/container
```

Usage
-----

[](#usage)

```
use Hackphp\Container\Container;

$container = Container::getInstance();

// bind class to the container by key = class name
$container->bind(ApiHandler::class, fn () => new ApiHandler("123"));

// bind by key = interface.
$conainer->bind(ApiInterface::class, TestApi::class);

// bind by key = string
$container->bind("api", fn () => new Api);

// bind singleton
$container->singleton(ApiInterface::class, fn () => new ApiHandler("123"));

// bind class without instructuions
$container->bind(TestApi::class);
$container->singleton(TestApi::class);

// pass the object instead of closure or string
$apiHandler = new ApiHandler("123");
$container->instance(ApiInterface::class, $apiHandler);

// resolve binding
$container->make("api"); // use string key
$container->make(ApiInterface::class);

// PSR-11
$container->get("api");
$container->has("api") // bool
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

1765d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b8d2c594fd2fc1ff26195258817c14019d49061464450e46ec58788ed9728469?d=identicon)[samirzz](/maintainers/samirzz)

---

Top Contributors

[![mohamed-samir907](https://avatars.githubusercontent.com/u/40417075?v=4)](https://github.com/mohamed-samir907 "mohamed-samir907 (3 commits)")

---

Tags

containerdependency-injectionhackphpphpswoole

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hackphp-container/health.svg)

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

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k447.1M9.0k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706127.7M12.6k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31180.7M2.3k](/packages/illuminate-container)[symfony/type-info

Extracts PHP types information.

20062.9M225](/packages/symfony-type-info)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

749284.3k37](/packages/civicrm-civicrm-core)

PHPackages © 2026

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