PHPackages                             oliviermadre/dic-it - 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. oliviermadre/dic-it

Abandoned → [Evaneos/dic-it](/?search=Evaneos%2Fdic-it)Library

oliviermadre/dic-it
===================

Yet another dependency injection container

26.4k5[1 PRs](https://github.com/oliviermadre/dic-it/pulls)PHP

Since Nov 1Pushed 4y agoCompare

[ Source](https://github.com/oliviermadre/dic-it)[ Packagist](https://packagist.org/packages/oliviermadre/dic-it)[ RSS](/packages/oliviermadre-dic-it/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

dic-it
======

[](#dic-it)

[![Build Status](https://camo.githubusercontent.com/5c52430baaf6d0d6b4d4da59ec428c817bdbcbb0ea532b2f98b2be23dab7b1cb/68747470733a2f2f7472617669732d63692e6f72672f6f6c69766965726d616472652f6469632d69742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/oliviermadre/dic-it)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/15cfa63ca40b301b15467a1de79f4a856ee71be45409ab537a12bc4ac46d5824/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6c69766965726d616472652f6469632d69742f6261646765732f7175616c6974792d73636f72652e706e673f733d33306464323834376631653261613862366465313739356364386534363061643235303937653435)](https://scrutinizer-ci.com/g/oliviermadre/dic-it/)[![Code Coverage](https://camo.githubusercontent.com/9b5269cc0211636c0015a5556098525483e8430e8d5ec5ecad2ba27ce9fbcf88/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6c69766965726d616472652f6469632d69742f6261646765732f636f7665726167652e706e673f733d34653235383238626438666334343761306334306537633437643439653966663465636263313962)](https://scrutinizer-ci.com/g/oliviermadre/dic-it/)[![Dependency Status](https://camo.githubusercontent.com/0c2e9a9185b3412705cd78ceefa1533aceb9341c43e6cffb5e9dd07ea2e57c02/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f6f6c69766965726d616472653a6469632d69742f6465762d6d61737465722f62616467652e706e67)](https://www.versioneye.com/php/oliviermadre:dic-it/dev-master)

DIC-IT is a simple dependency injection container, with extensible activation &amp; injection strategies.

Setup
-----

[](#setup)

The recommended setup is to create a config folder at the root of your repository. All configuration is based on YAML files.

Sample YAML file :

```
parameters:
    MyParameter: 'Some parameter value'
    MyOtherParameter: 42
    MyParameters:
        nested_level:
            foo : foo
            bar : bar
            baz : foobar
classes:
    MyServiceName:
        class: \Fully\Qualified\ClassName
        arguments: [ @MyDependency, %MyParameter, %MyParameters.nested_level, 'Hard-coded value', $container, $env.ENV, $const.ROOT_PATH ]
    MyDependency:
        class: \Fully\Qualified\DependencyClassName
        props:
            MyProperty: %MyOtherParameter

```

References
----------

[](#references)

You can inject different kind of references inside class definitions. You can get other service instances, parameters, the container itself, env variables, and constant values.

- @ServiceName : fetch an instance of that definition
- %param : fetch a parameter defined in the container
- $container : fetch the container itself
- $env.ENV\_NAME : fetch an environment variable
- $const.CONST\_NAME : fetch a global defined constant value

Using includes
--------------

[](#using-includes)

The configuration can be split into multiple files to ease management of your dependencies :

```
includes:
    - relative/file.yml
    - relative/another-file.yml

classes:
    ...

```

This allows you to separate parameters from service definitions for example.

Default object life-cycle
-------------------------

[](#default-object-life-cycle)

By default, all objects are created as non-singleton (this will definitely change) objects, so every time a reference is resolved by the container, a new instance of the requested object is created.

Managing circular dependencies
------------------------------

[](#managing-circular-dependencies)

By default, circular dependencies are not handled well (stack overflow...) due the default object life-cycle. To enable circular dependencies for a given object, at least one of the two objects must be defined as a singleton. This however will not yield the expected results, so it is *highly* recommended to define both objects involved in the circular dependency as singletons.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87% 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.

### Community

Maintainers

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

---

Top Contributors

[![oliviermadre](https://avatars.githubusercontent.com/u/1543271?v=4)](https://github.com/oliviermadre "oliviermadre (40 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")[![christophehurpeau](https://avatars.githubusercontent.com/u/302891?v=4)](https://github.com/christophehurpeau "christophehurpeau (1 commits)")[![joelwurtz](https://avatars.githubusercontent.com/u/90466?v=4)](https://github.com/joelwurtz "joelwurtz (1 commits)")[![robink](https://avatars.githubusercontent.com/u/116530?v=4)](https://github.com/robink "robink (1 commits)")

### Embed Badge

![Health badge](/badges/oliviermadre-dic-it/health.svg)

```
[![Health](https://phpackages.com/badges/oliviermadre-dic-it/health.svg)](https://phpackages.com/packages/oliviermadre-dic-it)
```

PHPackages © 2026

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