docs(articles): Magento and Symfony project trees with hierarchy, checked against the official structure
en/articles/magento-to-symfony/basics/structure.md
+96
β37
4
4
5
5
::::columns
6
6
:::col
7
β
**Magento** Β· module tree
7
+
**Magento** Β· project tree with a module
8
8
9
9
```text
10
β
app/
11
β
code/Vendor/Faq/
12
β
registration.php
13
β
etc/module.xml di.xml events.xml
14
β
etc/frontend/routes.xml
15
β
etc/adminhtml/system.xml menu.xml
16
β
etc/acl.xml webapi.xml crontab.xml
17
β
etc/db_schema.xml
18
β
Api/ Api/Data/
19
β
Model/ Model/ResourceModel/
20
β
Controller/ Block/ ViewModel/
21
β
view/frontend/layout/ templates/ web/
22
β
etc/env.php config.php
23
β
bin/magento
24
β
generated/
25
β
pub/index.php pub/static/
26
β
var/ vendor/
10
+
<magento-root>/
11
+
βββ app/
12
+
β βββ code/
13
+
β β βββ Vendor/
14
+
β β βββ Faq/
15
+
β β βββ registration.php
16
+
β β βββ composer.json
17
+
β β βββ Api/
18
+
β β β βββ Data/
19
+
β β βββ Block/
20
+
β β βββ Controller/
21
+
β β βββ Model/
22
+
β β β βββ ResourceModel/
23
+
β β βββ Observer/
24
+
β β βββ Plugin/
25
+
β β βββ Setup/
26
+
β β βββ ViewModel/
27
+
β β βββ etc/
28
+
β β β βββ module.xml
29
+
β β β βββ di.xml
30
+
β β β βββ events.xml
31
+
β β β βββ acl.xml
32
+
β β β βββ webapi.xml
33
+
β β β βββ crontab.xml
34
+
β β β βββ db_schema.xml
35
+
β β β βββ frontend/
36
+
β β β β βββ routes.xml
37
+
β β β βββ adminhtml/
38
+
β β β βββ menu.xml
39
+
β β β βββ system.xml
40
+
β β βββ i18n/
41
+
β β βββ view/
42
+
β β βββ frontend/
43
+
β β βββ layout/
44
+
β β βββ templates/
45
+
β β βββ web/
46
+
β βββ etc/
47
+
β βββ config.php
48
+
β βββ env.php
49
+
βββ bin/
50
+
β βββ magento
51
+
βββ generated/
52
+
βββ pub/
53
+
β βββ index.php
54
+
β βββ static/
55
+
βββ var/
56
+
βββ vendor/
27
57
```
28
58
:::
29
59
:::col
30
60
**Symfony** Β· application tree
31
61
32
62
```text
33
β
bin/console
34
β
config/
35
β
bundles.php
36
β
packages/ doctrine.yaml security.yaml
37
β
messenger.yaml monolog.yaml β¦
38
β
routes.yaml
39
β
services.yaml
40
β
migrations/
41
β
public/index.php
42
β
src/
43
β
Kernel.php
44
β
Controller/ Entity/ Repository/
45
β
Dto/ Message/ MessageHandler/
46
β
EventListener/ Security/
47
β
translations/
48
β
tests/
49
β
var/cache/ var/log/
50
β
vendor/
51
β
.env .env.local .env.test
63
+
<project>/
64
+
βββ bin/
65
+
β βββ console
66
+
βββ config/
67
+
β βββ bundles.php
68
+
β βββ preload.php
69
+
β βββ routes.yaml
70
+
β βββ services.yaml
71
+
β βββ packages/
72
+
β β βββ cache.yaml
73
+
β β βββ framework.yaml
74
+
β β βββ doctrine.yaml
75
+
β β βββ messenger.yaml
76
+
β β βββ monolog.yaml
77
+
β β βββ security.yaml
78
+
β βββ routes/
79
+
β βββ framework.yaml
80
+
βββ migrations/
81
+
βββ public/
82
+
β βββ index.php
83
+
βββ src/
84
+
β βββ Kernel.php
85
+
β βββ Controller/
86
+
β βββ Entity/
87
+
β βββ Repository/
88
+
β βββ EventListener/
89
+
β βββ Message/
90
+
β βββ MessageHandler/
91
+
β βββ Security/
92
+
β βββ Dto/
93
+
βββ templates/
94
+
βββ translations/
95
+
βββ tests/
96
+
βββ var/
97
+
β βββ cache/
98
+
β βββ log/
99
+
βββ vendor/
100
+
βββ .env
101
+
βββ .env.dev
102
+
βββ .env.test
103
+
βββ .env.local
104
+
βββ composer.json
105
+
βββ symfony.lock
52
106
```
53
107
:::
54
108
::::
109
+
110
+
- **Magento:** only `registration.php` and `etc/module.xml` are required, the other module folders appear when you need them. `app/etc/config.php` lists enabled modules, `env.php` holds the DB, cache and environment keys, `generated/` holds the generated Factory, Proxy and Interceptor classes.
111
+
- **Symfony:** `symfony/skeleton` creates `bin/`, `config/` (`bundles.php`, `preload.php`, `routes.yaml`, `services.yaml`, `packages/cache.yaml`, `packages/framework.yaml`), `public/index.php`, `src/Kernel.php` and `src/Controller/`, `.env` and `.env.dev` with `APP_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.local` yourself; it is not committed.
112
+
113
+
Sources: [Symfony project structure](https://symfony.com/doc/current/page_creation.html#checking-out-the-project-structure), [framework-bundle recipe](https://github.com/symfony/recipes/tree/main/symfony/framework-bundle/7.4), [Adobe Commerce module structure](https://developer.adobe.com/commerce/php/development/build/component-file-structure).
55
114
56
115
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`.