PHPackages                             his/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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. his/container

AbandonedLibrary[PSR &amp; Standards](/categories/psr-standards)

his/container
=============

Hack Standard Interface for Service Container.

v0.1.1(6y ago)33761MITHack

Since Mar 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/hack-interface-standards/container)[ Packagist](https://packagist.org/packages/his/container)[ RSS](/packages/his-container/feed)WikiDiscussions master Synced 4d ago

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

RFC
===

[](#rfc)

Container interface
-------------------

[](#container-interface)

This document describes a common interface for dependency injection containers.

The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a container to obtain objects and parameters (called entries in the rest of this document).

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

The word implementor in this document is to be interpreted as someone implementing the `ContainerInterface` in a dependency injection-related library or framework. Users of dependency injections containers (DIC) are referred to as user.

### Specification

[](#specification)

#### 1.1 Basics

[](#11-basics)

- The `His\Container\ContainerInterface` exposes two methods : `get` and `has`.
- `get` takes one mandatory parameter: an entry type. It MUST be a `typename`. A call to get MUST return the type implementation, or throws an exception if the type is not known to the container. Two successive calls to get with the same type SHOULD return the same value. However, depending on the implementor design and/or user configuration, different values might be returned, so user SHOULD NOT rely on getting the same value on 2 successive calls. While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations MAY accept additional optional parameters.
- `has` takes one unique parameter: an entry type. It MUST return true if an entry type is known to the container and false if it is not. `has($service)` returning true does not mean that `get($service)` will not throw an exception. It does however mean that `get($service)` will not throw a `NotFoundExceptionInterface`.

#### 1.2 Exceptions

[](#12-exceptions)

Exceptions directly thrown by the container MUST implement the `His\Container\Exception\ContainerExceptionInterface`.

A call to the get method with a non-existing `service` SHOULD throw a `His\Container\Exception\NotFoundExceptionInterface`.

#### 1.3 Additional features

[](#13-additional-features)

This section describes additional features that MAY be added to a container. Containers are not required to implement these features to respect the `ContainerInterface`.

##### 1.3.1 Delegate lookup feature

[](#131-delegate-lookup-feature)

The goal of the delegate lookup feature is to allow several containers to share entries. Containers implementing this feature can perform dependency lookups in other containers.

Containers implementing this feature will offer a greater lever of interoperability with other containers. Implementation of this feature is therefore RECOMMENDED.

A container implementing this feature:

- MUST implement the ContainerInterface
- MUST provide a way to register a delegate container (using a constructor parameter, or a setter, or any possible way). The delegate container MUST implement the ContainerInterface.

When a container is configured to use a delegate container for dependencies:

- Calls to the `get` method should only return an entry if the entry is part of the container. If the entry is not part of the container, an exception should be thrown (as requested by the `ContainerInterface`).
- Calls to the `has` method should only return true if the entry is part of the container. If the entry is not part of the container, false should be returned.

Important! By default, the lookup SHOULD be performed on the delegate container only, not on the container itself.

It is however allowed for containers to provide exception cases for special entries, and a way to lookup into the same container (or another container) instead of the delegate container.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~416 days

Total

2

Last Release

2214d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b4d307c7389996f8ffd03a3e9f1e6069f9726d0c72dc733ccd3d1230339e774?d=identicon)[his](/maintainers/his)

---

Top Contributors

[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (4 commits)")[![usox](https://avatars.githubusercontent.com/u/5184763?v=4)](https://github.com/usox "usox (4 commits)")[![lexidor](https://avatars.githubusercontent.com/u/31805625?v=4)](https://github.com/lexidor "lexidor (1 commits)")

---

Tags

containerhacklanghhvmhisinterfacesinteroperabilitycontainercontainer-interopcontainer-interfacehhvmhackhis

### Embed Badge

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

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

###  Alternatives

[psr/container

Common Container Interface (PHP FIG PSR-11)

10.0k1.0B3.7k](/packages/psr-container)[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[league/tactician-container

Tactician integration for any container implementing PSR-11

7710.1M23](/packages/league-tactician-container)

PHPackages © 2026

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