PHPackages                             kambo/deinj - 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. kambo/deinj

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

kambo/deinj
===========

Dependency injection container

v0.0.1(8y ago)014MITPHPPHP &gt;=7.0.0

Since Dec 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kambo-1st/Deinj)[ Packagist](https://packagist.org/packages/kambo/deinj)[ RSS](/packages/kambo-deinj/feed)WikiDiscussions develop Synced 5d ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Deinj - simple dependency injection container
=============================================

[](#deinj---simple-dependency-injection-container)

[![Build Status](https://camo.githubusercontent.com/b05bc2a54e799a4cbd2b5ea5eb28f617f881f3186c4554e1d0f632c0f98a763a/68747470733a2f2f7472617669732d63692e6f72672f6b616d626f2d3173742f4465696e6a2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kambo-1st/Deinj)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8991ad0600e90c4b12a6da6d23eae4e704787b54b4ed81802d1f848d9524f399/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b616d626f2d3173742f4465696e6a2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kambo-1st/Deinj/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/1473da010f08f599f0bc36e7bcc9f1b2bcf5e1a83182643cf52cf10fd6df4070/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6b616d626f2d3173742f4465696e6a2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/kambo-1st/Deinj/)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Just another simple dependency injection container with following highlights:

- Support of PSR-11 - Container interface

Install
-------

[](#install)

Prefered way to install library is with composer:

```
composer require kambo/deinj
```

Usage
-----

[](#usage)

```
use Kambo\Deinj\Container;

use Kambo\Examples\Deinj\Transport;
use Kambo\Examples\Deinj\Mailer;
use Kambo\Examples\Deinj\UserManager;

// Create instance of the container.
$container = new Container;

// Set object factory method for identifier 'transport'.
$container->set(
    'transport',
    // Factory method is plain callback.
    function () {
        return new Transport();
    }
);

// Set object factory method for identifier 'mailer'.
$container->set(
    'mailer',
    // Factory method is plain callback. An instance of the container must be passed inside
    // the closure for allowing of the 'transport' injection.
    function ($container) {
        return new Mailer($container->get('transport'));
    }
);

// Set object factory method for identifier 'userManager'.
$container->set(
    'userManager',
    // Factory method is plain callback. An instance of the container must be passed inside
    // the closure for allowing of the 'mailer' injection.
    function ($container) {
        return new UserManager($container->get('mailer'));
    }
);

// Get instance of the UserManager service.
$userManager = $container->get('userManager');

// Call register method in the UserManager service.
$userManager->register('username', 'password');
```

License
-------

[](#license)

The MIT License (MIT),

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

3062d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1073586?v=4)[Øystein Kambo Tangerås](/maintainers/kambo)[@kambo](https://github.com/kambo)

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kambo-deinj/health.svg)

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

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k431.1M7.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31278.1M2.0k](/packages/illuminate-container)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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