mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-16 12:56:21 +02:00
README for DI
This commit is contained in:
@ -3,18 +3,7 @@
|
|||||||
namespace DesignPatterns\DependencyInjection;
|
namespace DesignPatterns\DependencyInjection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dependency Injection
|
* class Configuration
|
||||||
*
|
|
||||||
* Purpose:
|
|
||||||
* to implement a loosely coupled architecture in order to get better testable, maintainable and extendable code
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* - the Doctrine2 ORM uses dependency injection e.g. for Configuration that is injected into a Connection object. for
|
|
||||||
* testing purposes, one can easily create a mock object of the configuration and inject that into the connection
|
|
||||||
* object
|
|
||||||
* - Symfony and Zend Framework 2 already have containers for DI that create objects via a configuration array and
|
|
||||||
* inject them where needed (i.e. in Controllers)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Configuration
|
class Configuration
|
||||||
{
|
{
|
||||||
|
10
DependencyInjection/README.md
Normal file
10
DependencyInjection/README.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Dependency Injection
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
To implement a loosely coupled architecture in order to get better testable, maintainable and extendable code.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
* the Doctrine2 ORM uses dependency injection e.g. for Configuration that is injected into a Connection object. for testing purposes, one can easily create a mock object of the configuration and inject that into the connection object
|
||||||
|
* Symfony and Zend Framework 2 already have containers for DI that create objects via a configuration array and inject them where needed (i.e. in Controllers)
|
Reference in New Issue
Block a user