PHPackages                             jaeger-app/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jaeger-app/di

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

jaeger-app/di
=============

A dependency injection container.

0.1.1(9y ago)01221MITPHPPHP &gt;=5.4.0

Since Apr 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/jaeger-app/di)[ Packagist](https://packagist.org/packages/jaeger-app/di)[ RSS](/packages/jaeger-app-di/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (3)Used By (1)

Jaeger Dependency Injection Container
=====================================

[](#jaeger-dependency-injection-container)

[![Build Status](https://camo.githubusercontent.com/76bd9cba1ec2a887a9cdcf4c662d843cfec524578755abbe0518526a64e4d6a6/68747470733a2f2f7472617669732d63692e6f72672f6a61656765722d6170702f64692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jaeger-app/di)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/86fe08f50ad42e779983b0dc51d36e92f3b0de33b0aea6e7911f9e27256afb12/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61656765722d6170702f64692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jaeger-app/di/?branch=master)[![Author](https://camo.githubusercontent.com/125fbdac4bce1d0b560eb4a34b10e11849db5b79150219c1118cac66a4630297/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406d697468726136322d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/mithra62)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/jaeger-app/bootstrap/master/LICENSE)

A simple dependency injection container for use with Jaeger (or stand alone).

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

[](#installation)

Add `jaeger-app/di` as a requirement to your `composer.json`:

```
$ composer require jaeger-app/di
```

Adding Services
---------------

[](#adding-services)

Ideally, like all Jaeger classes, you should extend `Jaeger\Bootstrap` and initialize the parent services before adding your own like the below:

```
use \JaegerApp\Di;

class MyDi extends Di
{
    public function getServices()
    {
        $this->container = parent::getServices(); //init existing services

		//add new service
        $this->container['my_service'] = function ($c) {
            $settings = new NewService;
            return $settings;
        };

		return $this->container;
    }
}
```

You can also add new Services at run time by using the `setService($name, \Closure $function)` method.

```
use \JaegerApp\Di;

$di = new Di();
$callable = function() {
    return 'foo to the who';
};

$di->setService('test_service', $callable);
```

Calling Services Example
------------------------

[](#calling-services-example)

```
use \JaegerApp\Di;

$di = new Di();

//get all the services
$services = $di->getServices();

//get a specific service
$db = $services['db'];

//or get specific service directly
$db = $di->getService('db');
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Every ~76 days

Total

2

Last Release

3640d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/042722642fab9b3e2f7b0711428b40053a2be0d6a1b752e50e7a7fffd06fb712?d=identicon)[mithra62](/maintainers/mithra62)

---

Top Contributors

[![eric-lamb62](https://avatars.githubusercontent.com/u/1008036?v=4)](https://github.com/eric-lamb62 "eric-lamb62 (9 commits)")

---

Tags

dependency-injectiondi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jaeger-app-di/health.svg)

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

###  Alternatives

[level-2/dice

A minimalist Dependency injection container (DIC) for PHP. Please note: 3.0+ is only compatible with PHP 7.0. The 2.0 branch is compatbile with PHP 5.6.

437773.0k19](/packages/level-2-dice)[x-wp/di

The dependency injection container for WordPress

314.2k13](/packages/x-wp-di)

PHPackages © 2026

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