PHPackages                             mizmoz/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. [Framework](/categories/framework)
4. /
5. mizmoz/container

ActiveLibrary[Framework](/categories/framework)

mizmoz/container
================

Mizmoz DI Container

2.0.1(1y ago)01373MITPHPPHP &gt;=8.3

Since Aug 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mizmoz/container)[ Packagist](https://packagist.org/packages/mizmoz/container)[ RSS](/packages/mizmoz-container/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (7)Used By (3)

[Mizmoz](https://www.mizmoz.com/) / Container
=============================================

[](#mizmoz--container)

Aims
----

[](#aims)

- Be lightweight, lazy load all the things.
- Use PHP-FIG PSR-11 v2 interface
- Auto resolve when possible

Getting Started
---------------

[](#getting-started)

### Composer Installation

[](#composer-installation)

```
composer require mizmoz/container

```

### Basic Usage

[](#basic-usage)

```
use Mizmoz\Container;
$container = new Container;

// Add an item to the container
$container->add(MyClass::class, function () {
    return new MyClass('some', 'params');
});

// get the item
$myClass = $container->get(MyClass::class);

// Add a shared item
$container->addShared(MyClass::class, function () {
    return new MyClass();
}, Container::SHARED);

// get the shared item
$container->get(MyClass::class) === $container->get(MyClass::class);

// check if an item exists in the container
$container->has(MyClass::class);

// add an alias for easy access to items
$container->addAlias(SomeLogger::class, 'log');
```

### Class resolution

[](#class-resolution)

Basic constructor resolution is available.

```
// Pass the resolver in to the container
$container = new Container(new Resolver);

// silly example
$date = $container->get(DateTime::class);

// add entries to the container to have interfaces resolved
$container->add(SomeInterface::class, function () { return new Some(); });

// add a raw value to the container, these are always treated as shared objects.
$container->addValue('config', new Config());

// now auto resolve the class that requires the SomeInterface entry
$container->get(SomeUser::class);
```

### Container Helper

[](#container-helper)

Use the `ManageContainerTrait` to automatically have the container set on a class when it's returned via `get($id)`

### API

[](#api)

- `Entry add(string $id, callable $entry, string $type = Container::EXCLUSIVE)`
- `Entry addShared(string $id, callable $entry)`
- `Entry addExclusive(string $id, callable $entry)`
- `Entry addValue(string $id, $entry)`
- `Provider addServiceProvider(Contract\ServiceProvider $serviceProvider)`
- `Container addAlias(string $id, string $alias)`
- `mixed get(string $id)`
- `bool has(string $id)`

Todo
----

[](#todo)

- Auto resolver improvements
    - Add ability to resolve basic arguments e.g. Resolve $secret in Connect(string $secret)
- Add event notifications with Mizmoz\\Event

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 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 ~522 days

Recently: every ~652 days

Total

6

Last Release

623d ago

Major Versions

1.3.0 → 2.0.02024-09-26

PHP version history (2 changes)1.0.0PHP &gt;=7.0

2.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/733223?v=4)[Ian Chadwick](/maintainers/ianchadwick)[@ianchadwick](https://github.com/ianchadwick)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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