docs(articles): Magento and Symfony project trees with hierarchy, checked against the official structure
en/articles/magento-to-symfony/basics/structure.md
+96
β37
Project structure
A new project: symfony new faq --webapp (Symfony CLI) or composer create-project symfony/skeleton faq for a minimal set. Flex adds packages together with their config: composer require orm creates config/packages/doctrine.yaml and the DATABASE_URL variable.
Magento Β· module tree
app/
code/Vendor/Faq/
registration.php
etc/module.xml di.xml events.xml
etc/frontend/routes.xml
etc/adminhtml/system.xml menu.xml
etc/acl.xml webapi.xml crontab.xml
etc/db_schema.xml
Api/ Api/Data/
Model/ Model/ResourceModel/
Controller/ Block/ ViewModel/
view/frontend/layout/ templates/ web/
etc/env.php config.php
bin/magento
generated/
pub/index.php pub/static/
var/ vendor/
Symfony Β· application tree
bin/console
config/
bundles.php
packages/ doctrine.yaml security.yaml
messenger.yaml monolog.yaml β¦
routes.yaml
services.yaml
migrations/
public/index.php
src/
Kernel.php
Controller/ Entity/ Repository/
Dto/ Message/ MessageHandler/
EventListener/ Security/
translations/
tests/
var/cache/ var/log/
vendor/
.env .env.local .env.test
Magento Β· project tree with a module
<magento-root>/
βββ app/
β βββ code/
β β βββ Vendor/
β β βββ Faq/
β β βββ registration.php
β β βββ composer.json
β β βββ Api/
β β β βββ Data/
β β βββ Block/
β β βββ Controller/
β β βββ Model/
β β β βββ ResourceModel/
β β βββ Observer/
β β βββ Plugin/
β β βββ Setup/
β β βββ ViewModel/
β β βββ etc/
β β β βββ module.xml
β β β βββ di.xml
β β β βββ events.xml
β β β βββ acl.xml
β β β βββ webapi.xml
β β β βββ crontab.xml
β β β βββ db_schema.xml
β β β βββ frontend/
β β β β βββ routes.xml
β β β βββ adminhtml/
β β β βββ menu.xml
β β β βββ system.xml
β β βββ i18n/
β β βββ view/
β β βββ frontend/
β β βββ layout/
β β βββ templates/
β β βββ web/
β βββ etc/
β βββ config.php
β βββ env.php
βββ bin/
β βββ magento
βββ generated/
βββ pub/
β βββ index.php
β βββ static/
βββ var/
βββ vendor/
Symfony Β· application tree
<project>/
βββ bin/
β βββ console
βββ config/
β βββ bundles.php
β βββ preload.php
β βββ routes.yaml
β βββ services.yaml
β βββ packages/
β β βββ cache.yaml
β β βββ framework.yaml
β β βββ doctrine.yaml
β β βββ messenger.yaml
β β βββ monolog.yaml
β β βββ security.yaml
β βββ routes/
β βββ framework.yaml
βββ migrations/
βββ public/
β βββ index.php
βββ src/
β βββ Kernel.php
β βββ Controller/
β βββ Entity/
β βββ Repository/
β βββ EventListener/
β βββ Message/
β βββ MessageHandler/
β βββ Security/
β βββ Dto/
βββ templates/
βββ translations/
βββ tests/
βββ var/
β βββ cache/
β βββ log/
βββ vendor/
βββ .env
βββ .env.dev
βββ .env.test
βββ .env.local
βββ composer.json
βββ symfony.lock
- Magento: only
registration.phpandetc/module.xmlare required, the other module folders appear when you need them.app/etc/config.phplists enabled modules,env.phpholds the DB, cache and environment keys,generated/holds the generated Factory, Proxy and Interceptor classes. - Symfony:
symfony/skeletoncreatesbin/,config/(bundles.php,preload.php,routes.yaml,services.yaml,packages/cache.yaml,packages/framework.yaml),public/index.php,src/Kernel.phpandsrc/Controller/,.envand.env.devwithAPP_SECRET. Everything else comes from packages (Flex recipes:doctrine.yaml,migrations/,src/Entity/,templates/,.env.test) and MakerBundle commands (make:message,make:listener,make:voter).Dto/is a project convention, and you create.env.localyourself; it is not committed.
Laying out src/ by technical layers (Controller, Entityβ¦) is only a starting template. For a large project you can group by domain (src/Faq/β¦, src/Catalog/β¦), the framework doesn't restrict this: services.yaml registers everything in src/, and Doctrine looks for entities wherever you point it in doctrine.yaml.