magento-di

Installation
SKILL.md

Magento 2 Dependency Injection

Before writing code

Fetch live docs:

  1. Web-search site:developer.adobe.com commerce php development components dependency-injection for the DI guide
  2. Fetch https://developer.adobe.com/commerce/php/development/ and navigate to DI documentation
  3. Web-search site:developer.adobe.com commerce php development build di-xml for di.xml reference

Conceptual Architecture

How DI Works in Magento

Magento's Object Manager reads di.xml configurations and automatically injects dependencies into class constructors. You declare what you need; the framework provides it.

Constructor injection is the primary pattern — declare dependencies as constructor parameters with type hints.

di.xml Scope

Related skills
Installs
3
GitHub Stars
29
First Seen
Mar 31, 2026