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

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

assodepicche/php-di-container
=============================

A PHP Dependency Injection Container

02PHP

Since Nov 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/AssoDePicche/php-di-container)[ Packagist](https://packagist.org/packages/assodepicche/php-di-container)[ RSS](/packages/assodepicche-php-di-container/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

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

[](#dependency-injection-container)

According to [DotNetTricks](https://www.dotnettricks.com/learn/dependencyinjection/what-is-ioc-container-or-di-container), a DI Container is a framework to create dependencies and inject them automatically when required. It automatically creates objects based on the request and injects them when required. DI Container helps us to manage dependencies within the application in a simple and easy way.

The DI container creates an object of the defined class and also injects all the required dependencies as an object a constructor, a property, or a method that is triggered at runtime and disposes itself at the appropriate time. This process is completed so that we don't have to create and manage objects manually all the time.

These repository contains a DI container for PHP projects.

Table of Contents
-----------------

[](#table-of-contents)

1. [The Interface](#the-interface)
2. [The Implementation](#the-implementation)
3. [Installation](#installation)
4. [Getting Started](#getting-started)
5. [Contributing](#contributing)
6. [Get in Touch](#get-in-touch)

### The Interface

[](#the-interface)

The `Dependency Injection Container` interface defines four methods: `autowire`, `get`, `set` and `singleton`. All these methods expect a class or interface name as a string, but only the last two methods also expect a `callable`, which represents a definition of the class or interface.

```
