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(3y ago)059MITPHP

Since May 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/rxak-php/Container)[ Packagist](https://packagist.org/packages/exan/container)[ RSS](/packages/exan-container/feed)WikiDiscussions main Synced 2d 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 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

1136d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/50845695?v=4)[exan](/maintainers/exan)[@exan](https://github.com/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.2k455.6M9.6k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.4k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

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

564576.7k53](/packages/ecotone-ecotone)[symfony/type-info

Extracts PHP types information.

20069.8M270](/packages/symfony-type-info)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

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