mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-11 16:23:57 +02:00
16 lines
616 B
Markdown
16 lines
616 B
Markdown
---
|
|
title: Dependency Injection
|
|
anchor: dependency_injection
|
|
---
|
|
|
|
# Dependency Injection {#dependency_injection_title}
|
|
|
|
From [Wikipedia](https://wikipedia.org/wiki/Dependency_injection):
|
|
|
|
> Dependency injection is a software design pattern that allows the removal of hard-coded dependencies and makes it
|
|
> possible to change them, whether at run-time or compile-time.
|
|
|
|
This quote makes the concept sound much more complicated than it actually is. Dependency Injection is providing a
|
|
component with its dependencies either through constructor injection, method calls or the setting of properties. It is
|
|
that simple.
|