Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 3d4c110

Browse files
#5924: Add clarification to required files in About component file structure page (#6184)
* #5924: Add clarification to required files in About component file structure page https://devdocs.magento.com/guides/v2.2/extension-dev-guide/prepare/prepare_file-str.html https://devdocs.magento.com/guides/v2.3/extension-dev-guide/prepare/prepare_file-str.html * Copy edit * Copy edit * Copy edit Co-authored-by: Jeff Matthews <matthews.jeffery@gmail.com>
1 parent b37272c commit 3d4c110

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Required files
2+
3+
The following files are required for all components:
4+
5+
* `registration.php`: Among other things, this file specifies the directory in which the component is installed by vendors in production environments. By default, Composer automatically installs components in the `<Magento root dir>/vendor` directory. For more information, see [Component registration]({{ page.baseurl }}/extension-dev-guide/build/component-registration.html).
6+
* `composer.json`: Specifies component dependencies and other metadata. For more information, see [Composer integration]({{ page.baseurl }}/extension-dev-guide/build/composer-integration.html).
7+
8+
Each component has an additional component-specific required file:
9+
10+
| Component Type | Required file | Description |
11+
| --- | --- | --- |
12+
| `magento2-module` | [module.xml]({{page.baseurl}}/architecture/archi_perspectives/components/modules/mod_depend.html#managing-module-dependencies) | This file defines basic information about the component, such as component dependencies and version number. Magento uses the version number to determine which schema and data to update when executing `bin/magento setup:upgrade`. |
13+
| `magento2-theme` | [theme.xml]({{page.baseurl}}/frontend-dev-guide/themes/theme-create.html#fedg_create_theme_how-to_declare) | Describes the Magento theme. File specifies a theme name in the `title` node, a parent theme (optional), and a theme preview image (optional) in the `media/preview_image` node. |
14+
| `magento2-language` | [language.xml]({{page.baseurl}}/config-guide/cli/config-cli-subcommands-i18n.html#m2devgde-xlate-files) | Declares a language translation package. |

src/_includes/php-dev/component-root-2.3.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,4 @@ A component's root directory matches the component's name and contains all its s
1111

1212
* `<Magento install directory>/vendor`: You will find this location for installations that use the [`composer create-project`]({{page.baseurl}}/install-gde/composer.html) to install the Magento 2 metapackage (which downloads the CE or EE code). You will also find this location if you install Magento by extracting the [compressed Magento 2 archive]({{page.baseurl}}/install-gde/prereq/zip_install.html).
1313

14-
Magento installs third-party components in the `vendor` directory. But we recommend adding your components to the `app/code` directory. If you put your component in the `vendor` directory, Git will ignore it because Magento adds the `vendor` directory to the `.gitignore` file.
15-
16-
### Required files
17-
18-
All components require these three files:
19-
20-
* `registration.php`: This file registers your component with Magento. It uses the component's root directory name as the component name. By default, the composer installs components in the `<Magento root dir>/vendor` directory. For more information, see [Component registration]({{page.baseurl}}/extension-dev-guide/build/component-registration.html).
21-
* `etc/module.xml`: This file defines basic information about the component, such as component dependencies and version number. Magento uses the version number to determine which schema and data to update when executing `bin/magento setup:upgrade`.
22-
* `composer.json`: This file defines the dependencies that the component needs at runtime. For more information, see [Composer integration]({{page.baseurl}}/extension-dev-guide/build/composer-integration.html).
14+
Magento installs third-party components in the `<Magento install directory>/vendor` directory. But we recommend adding your components to the `<Magento install directory>/app/code` directory. If you add your component to the `<Magento install directory>/vendor` directory, [Git](https://git-scm.com/docs) will ignore it because Magento adds the `vendor` directory to the `<Magento install directory>/.gitignore` file.

src/_includes/php-dev/component-root.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,4 @@ A component's root directory is the top-level directory for that component under
1111

1212
* `<Magento install directory>/vendor`: This location is found in the alternative setups where the {% if page.guide_version == "2.0" %} [`composer create-project`]({{page.baseurl}}/install-gde/prereq/integrator_install.html) {% else %} [`composer create-project`]({{page.baseurl}}/install-gde/composer.html). {% endif %} command was used to get a Magento 2 metapackage (which downloads the CE or EE code), or a [compressed Magento 2 archive]({{ page.baseurl }}/install-gde/prereq/zip_install.html) was extracted in order to install Magento.
1313

14-
Any third party components (and the Magento application itself) are downloaded and stored under the `vendor` directory. If you are using Git to manage project, this directory is typically added to the `.gitignore` file. Therefore, we recommend you do your customization work in `app/code`, not `vendor`.
15-
16-
### Required files
17-
18-
The following files are required for all components:
19-
20-
* `registration.php`: Among other things, this file specifies the directory in which the component is installed by vendors in production environments. By default, composer automatically installs components in the `<Magento root dir>/vendor` directory. For more information, see [Component registration]({{ page.baseurl }}/extension-dev-guide/build/component-registration.html).
21-
* `etc/module.xml`: This file specifies basic information about the component such as the components dependencies and its version number. This version number is used to determine schema and data updates when `bin/magento setup:upgrade` is run.
22-
* `composer.json`: Specifies component dependencies and other metadata. For more information, see [Composer integration]({{ page.baseurl }}/extension-dev-guide/build/composer-integration.html).
14+
Any third-party components (and the Magento application itself) are downloaded and stored under the `<Magento install directory>/vendor` directory. If you are using [Git](https://git-scm.com/docs) to manage your project, this directory is typically added to the `<Magento install directory>/.gitignore` file. Therefore, we recommend you do your customization work in `<Magento install directory>/app/code`, not `<Magento install directory>/vendor`.

src/guides/v2.2/extension-dev-guide/prepare/prepare_file-str.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ In addition, you can choose the component root directory to start development. T
99

1010
{% include php-dev/component-root.md %}
1111

12+
{% include php-dev/component-required-files.md %}
13+
1214
{:.ref-header}
1315
Related topic
1416

src/guides/v2.3/extension-dev-guide/prepare/prepare_file-str.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ In addition, you can choose the component root directory to start development. T
1010

1111
{% include php-dev/component-root-2.3.md %}
1212

13+
{% include php-dev/component-required-files.md %}
14+
1315
{:.ref-header}
1416
Related topic
1517

0 commit comments

Comments
 (0)