PHPackages                             dmitry-suffi/di - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. dmitry-suffi/di

ActiveProject[PSR &amp; Standards](/categories/psr-standards)

dmitry-suffi/di
===============

dependency injection container

2.0.0(6y ago)090MITPHPPHP &gt;=7.0.0CI failing

Since Jul 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/dmitry-suffi/di-container)[ Packagist](https://packagist.org/packages/dmitry-suffi/di)[ Docs](https://github.com/dmitry-suffi/di-container)[ RSS](/packages/dmitry-suffi-di/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (4)Versions (15)Used By (0)

Dependency injection container
==============================

[](#dependency-injection-container)

[![Build Status](https://camo.githubusercontent.com/867bef0f47d724a271fae1ddedc36136974da6fc1043914b127a9d4038c235d9/68747470733a2f2f6170692e7472617669732d63692e6f72672f646d697472792d73756666692f64692d636f6e7461696e65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dmitry-suffi/di-container)[![Coveralls](https://camo.githubusercontent.com/093c1488d1469337b1e98daf6ffdc864c1d97661abde28630eb4d6789facf2c8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f646d697472792d73756666692f64692d636f6e7461696e65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/dmitry-suffi/di-container?branch=master)

Dependency injection container [Martin Fowler's article](http://martinfowler.com/articles/injection.html)

Dependency injection container — it is an object to instantiate the class and its dependent objects.

This is in accordance with the recommendations of PSR-11.

It supports the following kinds of dependency injection:

- Constructor injection;
- Property injection;
- Setter injection

### Example:

[](#example)

```
use suffi\di\Container;

$foo = new Foo();
$bar = new Bar();
$thy = new Thy();

$container->set('foo', $foo);
$container->set('bar', $bar);
$container->set('thy', $thy);

$container->setDefinition('common', 'Common')
    ->parameter('foo', 'foo')
    ->property('bar', $bar)
    ->setter('thy', 'thy');

$common = $container->get('common');
```

Installation
------------

[](#installation)

```
composer require dmitry-suffi/di

```

Documentation
-------------

[](#documentation)

the documentation can be found here:

- [English](docs/en)
- [Russian](docs/ru)

Tests
-----

[](#tests)

You can also browse the [functional tests](tests/)

License
-------

[](#license)

Copyright (c) 2016-2016 Dmitry Suffi. Released under the [MIT](LICENSE?raw=1) license.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Recently: every ~229 days

Total

9

Last Release

2458d ago

Major Versions

0.1.0 → 1.0.02016-07-15

1.2.2 → 2.0.02019-10-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/2721e2bebe88679b1fc4abe763d5a9cccee0aa9148b71545c24802ce9ae41ff7?d=identicon)[dmitry-suffi](/maintainers/dmitry-suffi)

---

Top Contributors

[![dmitry-suffi](https://avatars.githubusercontent.com/u/10375400?v=4)](https://github.com/dmitry-suffi "dmitry-suffi (84 commits)")

---

Tags

dependency-injectiondidi-containerpsr-11containerdi

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dmitry-suffi-di/health.svg)

```
[![Health](https://phpackages.com/badges/dmitry-suffi-di/health.svg)](https://phpackages.com/packages/dmitry-suffi-di)
```

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86892.2M418](/packages/league-container)[php-di/php-di

The dependency injection container for humans

2.8k53.2M1.2k](/packages/php-di-php-di)[aura/di

A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.

352982.2k60](/packages/aura-di)[league/tactician-container

Tactician integration for any container implementing PSR-11

7710.3M24](/packages/league-tactician-container)[mrclay/props-dic

Props is a simple DI container that allows retrieving values via custom property and method names

3512.4M3](/packages/mrclay-props-dic)[slince/di

A flexible dependency injection container

20268.4k6](/packages/slince-di)

PHPackages © 2026

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