Project structure

← Project structure

Ashterix

docs(articles): explain the project trees with tables instead of a dense list

en/articles/magento-to-symfony/basics/structure.md +25 βˆ’3

107 107 :::
108 108 ::::
109 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.
110 + ## What is in the Magento tree
112 111
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).
112 + | Path | What it is |
113 + |---|---|
114 + | `registration.php`, `etc/module.xml` | Required module files. The other folders appear when you need them. |
115 + | `app/etc/config.php` | The list of enabled modules. |
116 + | `app/etc/env.php` | DB, cache and environment keys. |
117 + | `generated/` | Generated Factory, Proxy and Interceptor classes. |
114 118
119 + ## Where the Symfony tree comes from
120 +
121 + | Path | Created by |
122 + |---|---|
123 + | `bin/`, `config/`, `public/index.php`, `src/Kernel.php`, `src/Controller/` | `symfony/skeleton` |
124 + | `.env`, `.env.dev` with `APP_SECRET` | the `framework-bundle` recipe |
125 + | `config/packages/doctrine.yaml`, `migrations/`, `src/Entity/`, `src/Repository/` | `composer require orm` |
126 + | `templates/` | `composer require twig` |
127 + | `tests/`, `.env.test` | `composer require --dev symfony/test-pack` |
128 + | `src/Message/`, `src/MessageHandler/` | `make:message` |
129 + | `src/EventListener/` | `make:listener` |
130 + | `src/Security/Voter/` | `make:voter` |
131 + | `src/Dto/` | a project convention |
132 + | `.env.local` | you create it yourself; it is not committed |
133 +
134 +
115 135 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`.
136 +
137 + 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).