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

ActiveLibrary[Framework](/categories/framework)

unity/container
===============

Unity framework dependency manager.

0.1(7y ago)224MITPHPCI failing

Since Nov 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/unity-framework/Container)[ Packagist](https://packagist.org/packages/unity/container)[ RSS](/packages/unity-container/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Unity/Container
===============

[](#unitycontainer)

An out of box dependency manager for PHP projects.

- [Introduction](#introduction)
    - [Installation](#installation)
- [Usage](#usage)
    - [Set](#set)
    - [Get](#get)
    - [Make](#make)
    - [Has](#has)
    - [Bind](#bind)
    - [Autowiring](#autowiring)
    - [Use annotations](#use-annotation)
- [Best practices](#best-practices)
- [Support](#support)
- [Contribute](#contribute)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

Let's take a look at this class:

```
class Logger
{
    protected $fileLogger;

    public function __construct(FileLogger $fileLogger)
    {
        $this->fileLogger = $fileLogger;
    }

    public function log($message)
    {
        return $this->fileLogger->log($message);
    }
}
```

The problem with this class is that it's coupled to a specific Logger.

What if one day we change our mind and want to start sending our logs via email? We need to get back to this class and change the logger from FileLogger to EmailLogger

Refatoring:

```
class Logger
{
    protected $driver;

    public function __construct(LoggerDriverInterface $driver)
    {
        $this->driver = $driver;
    }

    public function log($message)
    {
        return $this->driver->load($message);
    }
}
```

That way our class can accept any kind of file drivers and is coupled to a contract instead of a concrete implememnation.

But what if you have a lot of classes to manage?

There's where the container comes.

### Installation

[](#installation)

```
composer require unity/container

```

Usage
-----

[](#usage)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

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

2742d ago

### Community

Maintainers

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

---

Top Contributors

[![e200](https://avatars.githubusercontent.com/u/20504726?v=4)](https://github.com/e200 "e200 (194 commits)")

---

Tags

containerdependency-injectiondiinversion-of-controliocpsr-11

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[cakephp/core

CakePHP Framework Core classes

6026.8M39](/packages/cakephp-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)

PHPackages © 2026

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