PHPackages                             elverion/dependency-injection - 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. elverion/dependency-injection

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

elverion/dependency-injection
=============================

A minimalist dependency injection library for PHP

v1.0.3(1y ago)0329MITPHPPHP &gt;=7.4CI passing

Since Mar 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/elverion/dependency-injection)[ Packagist](https://packagist.org/packages/elverion/dependency-injection)[ RSS](/packages/elverion-dependency-injection/feed)WikiDiscussions main Synced 1mo ago

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

[![Packagist License](https://camo.githubusercontent.com/4399c91ba4432f4798ca127b7c91ab2a40a24352a3923fbef78e4b46300edd09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656c766572696f6e2f646570656e64656e63792d696e6a656374696f6e3f6c6162656c3d4c6963656e7365)](https://camo.githubusercontent.com/4399c91ba4432f4798ca127b7c91ab2a40a24352a3923fbef78e4b46300edd09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656c766572696f6e2f646570656e64656e63792d696e6a656374696f6e3f6c6162656c3d4c6963656e7365)[![Unit tests](https://camo.githubusercontent.com/f97514f7440f039f719dcdb0eda4b7938e42a19d0b119ea0166b533449dd5ac9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636865636b2d72756e732f656c766572696f6e2f646570656e64656e63792d696e6a656374696f6e2f6d61696e3f6c6162656c3d5465737473)](https://camo.githubusercontent.com/f97514f7440f039f719dcdb0eda4b7938e42a19d0b119ea0166b533449dd5ac9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636865636b2d72756e732f656c766572696f6e2f646570656e64656e63792d696e6a656374696f6e2f6d61696e3f6c6162656c3d5465737473)[![Packagist Version](https://camo.githubusercontent.com/0817fcc7b75cbc2430a57bab0f2ee40f1575ace61bb770bac7eaac55a26f8340/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c766572696f6e2f646570656e64656e63792d696e6a656374696f6e3f6c6162656c3d56657273696f6e)](https://camo.githubusercontent.com/0817fcc7b75cbc2430a57bab0f2ee40f1575ace61bb770bac7eaac55a26f8340/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c766572696f6e2f646570656e64656e63792d696e6a656374696f6e3f6c6162656c3d56657273696f6e)

### About

[](#about)

This project can be used to aid in [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) in your own projects. The implementation, which is PSR-11 container compliant, is as bare-bones as can be without compromising on functionality. It is capable of resolving concrete implementations for classes, interfaces, and bindings, and primitives, as well as invoking closures, functions, and bound methods with their dependencies.

### Requirements

[](#requirements)

php&gt;= 7.4### Installation

[](#installation)

##### Composer

[](#composer)

```
composer require elverion/dependency-injection
```

### Usage

[](#usage)

It is as simple as obtaining the instance of the container object and making use of the `->make()` or `->resolve()`methods (to obtain a concrete implementation of some abstract) or use `->call()` to call a method and inject dependencies into it. For example:

```
