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)225MITPHPCI 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 2w 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 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

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

2787d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20504726?v=4)[E L E A N D R O](/maintainers/e200)[@e200](https://github.com/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

[laravel/framework

The Laravel Framework.

34.8k543.8M19.5k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

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

The CakePHP framework

8.9k19.5M1.7k](/packages/cakephp-cakephp)[bref/bref

Bref is a framework to write and deploy serverless PHP applications on AWS Lambda.

3.4k10.6M64](/packages/bref-bref)[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)

PHPackages © 2026

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