Extension repository structure
For module, theme, and language pack component repositories, we recommend five best practices:
- Flatter hierarchy
- One extension type (module, theme, or language pack) per repository
- Multiple components per repository
- One component per repository
- One functional test suite per module component
Flatter hierarchy#
Your repository structure should no longer include app/code/<Vendor>/
directories.
Before:
Copied to your clipboard1<extension_repo_root\>2└── app/code/<Vendor>/3 └── <Module1>
After:
Copied to your clipboard1<extension_repo_root>/2└── <Module1>
One extension type per repository#
You cannot mix extension types (modules, themes, and language packs) in the same extension repository. Each component type must have its own repository. For example, you cannot do this:
Copied to your clipboard1// This is not supported2<extension_repo_root>3├── <Module1>4├── <theme1>5└── <language1>
Multiple components per repository#
If your extension is complex and requires several components, you can keep those components in the same repository to make the extension easy to package and maintain:
Copied to your clipboard1<extension_repo_root>2├── <Module1>3├── <Module2>4├── <Module1SampleData>5└── <Module2SampleData>
You can do the same for theme and language pack extensions:
Copied to your clipboard1<extension_repo_root>/2├── <theme1>3└── <theme2>
Copied to your clipboard1<extension_repo_root>/2├── <language1>3└── <language2>
One component per repository#
If your extension requires only one component, your <component_root>
directory and your <repo_root>
directory will be the same to reduce unnecessary hierarchy in the directory structure:
Copied to your clipboard1<MyModule_repo_root>2├── Api3├── Block4├── Controller5├── Console6├── etc7├── Helper8├── i18n9├── Model10├── Plugin11├── Test12├── view13├── composer.json14├── LICENSE.txt15└── ...
Test Suites#
Function tests can be added to a Test
directory within each module of your extension.
Note: Currently, only Unit and MFTF tests can be run from within a <Module>
directory.
Copied to your clipboard1<extension_repo_root>2├── <Module1>3│ ├── ...4│ ├── Test5│ │ ├── Unit6│ │ ├── Integration7│ │ └── Mftf8│ │ ├── TestSuite9│ │ └── composer.json10│ └── ...11├── <Module2>12├── <Module1SampleData>13└── <Module2SampleData>