PHPackages                             gandung/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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. gandung/dependency-injection

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

gandung/dependency-injection
============================

A dependency injection container

v1.0.4(9y ago)114011MITPHPPHP &gt;=5.6.0 || &gt;=7.1.0

Since May 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/plvhx/dependency-injection)[ Packagist](https://packagist.org/packages/gandung/dependency-injection)[ RSS](/packages/gandung-dependency-injection/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (4)Versions (7)Used By (1)

Simple Dependency Injection Library
===================================

[](#simple-dependency-injection-library)

[![Join the chat at https://gitter.im/dependency-injection-container/Lobby](https://camo.githubusercontent.com/e76d34bbc7e55aa71c0c5bdb36fbb8803deeb321e7d3df0348416cd5b1117245/68747470733a2f2f6261646765732e6769747465722e696d2f646570656e64656e63792d696e6a656374696f6e2d636f6e7461696e65722f4c6f6262792e737667)](https://gitter.im/dependency-injection-container/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Coverage Status](https://camo.githubusercontent.com/38d3a6f21bedfd6be21ec1a912c075c42b0bb2c8635a63dca038e8cb617f5345/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706c7668782f646570656e64656e63792d696e6a656374696f6e2f62616467652e737667)](https://coveralls.io/github/plvhx/dependency-injection)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/146788f6c48908b1eae7e94e1f4657e89d3395ea331354e6ea9a16ebd932a914/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706c7668782f646570656e64656e63792d696e6a656374696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/plvhx/dependency-injection/?branch=master)[![Build Status](https://camo.githubusercontent.com/bf537de9023a7390607947bbf257e84e856a44eaa1a35413e9b6829f6f3c9085/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706c7668782f646570656e64656e63792d696e6a656374696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/plvhx/dependency-injection/build-status/master)[![SensioLabsInsight](https://camo.githubusercontent.com/18603e3ee74b21f26f89531d82a078059ae5807e514342e4e1f50c1026d2577b/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f31346535306265382d633434312d346430332d623635642d6362303765333363303637322f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/14e50be8-c441-4d03-b65d-cb07e33c0672)

This is my simple dependency injection library in PHP

Features:
---------

[](#features)

```
  - Can resolve class dependency that placed only on constructor (autowiring)
  - Binding concrete dependency into unresolved abstract, either closure or class name.
  - Can do shared binding concrete dependency into unresolved abstract, either closure or class name.
  - Can resolve concrete implementation on typehinted interface on constructor method.
  - Can resolve concrete implementation which bound on interface directly.
  - Registering service under an alias.

```

Setter injection and method injection not yet implemented. Feel free to look, or clone it for your own needs.

Autowiring:
-----------

[](#autowiring)

Assume you have a class:

```
