AD0-E724 · Question #53
When creating a new module, where would the registration.php file be placed?
The correct answer is D. app/code/<Vendor>/<Module>. In Magento 2, custom modules live under app/code/<Vendor>/<Module>, making D correct - this is where Magento looks for user-created or third-party modules, and registration.php in that directory tells Magento the module exists and how to load it. Option A (app/modules/) is not…
Question
When creating a new module, where would the registration.php file be placed?
Options
- Aapp/modules/<Vendor>/<Module>
- Bvendor/modules/<Vendor>/<Module>
- Clib/<Vendor>/<Module>
- Dapp/code/<Vendor>/<Module>
How the community answered
(54 responses)- A7% (4)
- B2% (1)
- C4% (2)
- D87% (47)
Explanation
In Magento 2, custom modules live under app/code/<Vendor>/<Module>, making D correct - this is where Magento looks for user-created or third-party modules, and registration.php in that directory tells Magento the module exists and how to load it. Option A (app/modules/) is not a real Magento directory structure. Option B (vendor/modules/) conflates the vendor/ folder, which is reserved for Composer-managed packages, not hand-crafted modules. Option C (lib/) is for framework-level libraries and shared utilities, not module registration.
Memory tip: Think "app/code = your code" - anything you write goes in app/code, while vendor/ is for packages you install, not ones you create.
Topics
Community Discussion
No community discussion yet for this question.