PHPackages                             phpnomad/di-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. phpnomad/di-container

ActiveLibrary[Framework](/categories/framework)

phpnomad/di-container
=====================

Lightweight dependency injection container for PHPNomad

1.0.0(3mo ago)02.8k↓17.6%4MITPHP

Since Mar 31Pushed 2mo agoCompare

[ Source](https://github.com/phpnomad/di-container)[ Packagist](https://packagist.org/packages/phpnomad/di-container)[ RSS](/packages/phpnomad-di-container/feed)WikiDiscussions main Synced 4w ago

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

phpnomad/di-container
=====================

[](#phpnomaddi-container)

[![Latest Version](https://camo.githubusercontent.com/1ef77a5faadf70dc66bf798ce0762aac53b492ad005848df2f0c4f56321fc16a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f64692d636f6e7461696e65722e737667)](https://packagist.org/packages/phpnomad/di-container) [![Total Downloads](https://camo.githubusercontent.com/c4cb823935ed0132a2e755c3726aa3d6a7ff8a1f5be401d899baf199b2a49d83/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f64692d636f6e7461696e65722e737667)](https://packagist.org/packages/phpnomad/di-container) [![PHP Version](https://camo.githubusercontent.com/7828d34d7b57ae203753f75f1cf282978469481f3406401097e18718ff07e21d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f64692d636f6e7461696e65722e737667)](https://packagist.org/packages/phpnomad/di-container) [![License](https://camo.githubusercontent.com/69d48ff62cb25754efb9e24f80266404efca68e1e692a7a343387969a98e8f0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f64692d636f6e7461696e65722e737667)](https://packagist.org/packages/phpnomad/di-container)

`phpnomad/di-container` is the concrete dependency injection container that ships with [PHPNomad](https://phpnomad.com). It's a single class, `PHPNomad\Di\Container\Container`, that does reflection-based autowiring and needs no configuration files to work.

The split between interfaces and implementation is deliberate. `phpnomad/di` defines the contracts (`InstanceProvider`, `HasBindings`, `DiException`). `phpnomad/di-container` provides the class that implements them. Most applications install both, and installing `phpnomad/core` pulls them in transitively. PHPNomad has been running in production for years powering [Siren](https://sirenaffiliates.com) and several MCP servers, so this container has been resolving real dependency graphs the whole time.

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

[](#installation)

```
composer require phpnomad/di-container
```

Composer will pull in `phpnomad/di` automatically as a required dependency, so there's nothing else to install for a minimal setup.

Quick Start
-----------

[](#quick-start)

Construct the container, bind your abstracts to their concretes, and ask for what you need. Constructor dependencies are resolved recursively by reflection.

```
