1.01 وصف هيكل ملفات Magento
Learn the structure by ownership, not by memorizing names
If folder names feel hard to memorize, do not start with a list. Start with a simple question:
Who owns this part of Magento, and what is it used for?
- You own it:
app/code,app/design,app/i18n, and usuallyapp/etc/config.php. - The environment owns it:
app/etc/env.phpbecause it contains machine-specific and sensitive values. - Composer owns it:
vendor/. You install it, but you do not hand-edit it. - Magento generates it:
generated/and parts ofpub/static. - Runtime owns it:
var/for logs, cache, reports, and temporary files. - The browser should see it:
pub/.
The easy mental model
Imagine Magento as a building:
pub/is the front door customers are allowed to enter.app/codeis your workshop where you build custom functionality.vendor/is equipment delivered from suppliers; if you modify it directly, the next delivery can replace it.generated/is machine-produced helper material.var/is the storage room for temporary operational stuff.app/designis how the building looks.
What usually matters in the exam
- Custom modules:
app/code. - Themes:
app/design/frontendorapp/design/adminhtml. - Translations:
app/i18n. - Shared config in Git:
app/etc/config.php. - Sensitive env config not in Git:
app/etc/env.php. - CLI tool:
bin/magentoinsidebin/. - Generated classes:
generated/. - Public images:
pub/media. - Processed static assets:
pub/static. - Temporary files and logs:
var/. - Composer-installed packages:
vendor/.
Reason your way to the answer
When you see an exam question, ask yourself:
- Is this custom code, shared config, generated code, public output, or temporary runtime data?
- Should I edit it by hand, or should a tool own it?
- Should it be public, private, versioned, or disposable?
That reasoning will usually eliminate the wrong answers quickly.
Examples that make it stick
Question: "Where should a third-party extension live?"
Reasoning: Third-party code should be managed by Composer, so the safe answer is vendor/, not app/code.
Question: "Which file should not be committed because it is environment-specific?"
Reasoning: Secrets and machine-specific services belong in app/etc/env.php.
Question: "Why should the web server point to pub/?"
Reasoning: It reduces exposure of sensitive folders and keeps the public entry point narrow.
Useful commands
1bin/magento cache:flush
2bin/magento module:enable Vendor_Module
3bin/magento setup:upgrade
4bin/magento setup:static-content:deployOne-page memory shortcut
- Build:
app/code - Style:
app/design - Translate:
app/i18n - Configure shared:
app/etc/config.php - Configure secret:
app/etc/env.php - Run CLI:
bin/ - Generate:
generated/ - Publish:
pub/ - Temporary:
var/ - Dependencies:
vendor/
Reference notes: MageForge Topic 1.01 Documentation