A component's root directory matches the component's name and contains all its subdirectories and files. Based on how you installed Magento, you can put your component's root directory in one of two places:
-
<Magento install directory>/app: This is the recommended location for component development. You can set up this environment by Cloning the Magento 2 GitHub repository.- For modules, use
app/code. - For storefront themes, use
app/design/frontend. - For Admin themes, use
app/design/adminhtml. - For language packages, use
app/i18n.
- For modules, use
-
<Magento install directory>/vendor: You will find this location for installations that use thecomposer create-projectto install the Magento 2 metapackage (which downloads the CE or EE code).Magento installs third-party components in the
<Magento install directory>/vendordirectory. But we recommend adding your components to the<Magento install directory>/app/codedirectory. If you add your component to the<Magento install directory>/vendordirectory, Git will ignore it because Magento adds thevendordirectory to the<Magento install directory>/.gitignorefile.