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

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

exan/container
==============

Generic container implementation

1.0.1(2y ago)047MITPHP

Since May 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/rxak-php/Container)[ Packagist](https://packagist.org/packages/exan/container)[ RSS](/packages/exan-container/feed)WikiDiscussions main Synced 1mo ago

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

Container
=========

[](#container)

A minimal PSR-11 compliant container. Automatically resolves dependencies when possible.

Install
-------

[](#install)

```
composer require exan/container
```

Usage
-----

[](#usage)

```
$container = new Exan\Container();

$someClass = $container->get(SomeClass::class);
```

This will try to instantiate an instance of `SomeClass` for you and returns it. If you then request this class again further on, it will return the same instance.

Assuming no unresolvable dependencies, it will also resolve nested dependencies.

```
class SomeClass
{
    public function __construct(public readonly Dependency $dependency)
    {
        // ...
    }
}

$container = new Exan\Container();

$someClass = $container->get(SomeClass::class);
```

`SomeClass` in this example will be instantiated with an instance of `Dependency`.

It can also handle interfaces, but will not be able to resolve an implementation of said interface automatically. You will need to register an entry manually.

```
interface SomeInterface
{
    // ...
}

class SomeClass implements SomeInterface
{
    // ...
}

$container = new Exan\Container();

$container->register(SomeInterface::class, new SomeClass())

$someClass = $container->get(SomeInterface::class);
```

Note: it does not automatically resolve primitive types like `string` and `int`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Every ~0 days

Total

2

Last Release

1088d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a13e10cab42385db1f6f4f0bfd96f8c63ec419746648db02b30e7ea02d2f5df?d=identicon)[exan](/maintainers/exan)

---

Top Contributors

[![Exanlv](https://avatars.githubusercontent.com/u/51094537?v=4)](https://github.com/Exanlv "Exanlv (7 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[symfony/dependency-injection

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

4.2k431.1M7.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31278.1M2.0k](/packages/illuminate-container)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

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

728272.9k20](/packages/civicrm-civicrm-core)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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