2

I'm aware that the only required files for creating a module are registration.php and module.xml. But I'm seeing some of the popular blogs mentioning composer.json file in addition to the above. Any suggestions?

4

The three necessary files to bootstrap a module are

  1. registration.php
  2. etc/module.xml
  3. composer.json

    and in app/code pool these only required files needs to initiate a module:

    • registration.php
    • etc/module.xml
| improve this answer | |
0

composer.json used to register your package in magento module listing. It also useful to restriction module php versions and required modules(depend modules) for current module. Many more use are here. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/composer-integration.html

| improve this answer | |
0

I would like only to highlight that magento uses the word "recommended" regarding composer.json file (https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/composer-integration.html). May look a little confusing since many resources consider this file required. It is indeed required if we need to manage the module using composer.

composer.json file is also required for listing module's hard dependencies per magento architecture documentation at https://devdocs.magento.com/guides/v2.3/architecture/archi_perspectives/components/modules/mod_depend.html. Consequently this file is required in order to prevent installation and enabling one module while hard dependencies are missing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.