Module overview

What is a Magento module?

A module is a logical group – that is, a directory containing blocks, controllers, helpers, models – that are related to a specific business feature. In keeping with Magento’s commitment to optimal modularity, a module encapsulates one feature and has minimal dependencies on other modules.

Modules and themes are the units of customization in Magento. Modules provide business features, with supporting logic, while themes strongly influence user experience and storefront appearance. Both components have a life cycle that allows them to be installed, deleted, and disabled. From the perspective of both merchants and extension developers, modules are the central unit of Magento organization.

The Magento Framework provides a set of core logic: PHP code, libraries, and the basic functions that are inherited by the modules and other components.

Module purpose

The purpose of each module is to provide specific product features by implementing new functionality or extending the functionality of other modules. Each module is designed to function independently, so the inclusion or exclusion of a particular module does not typically affect the functionality of other modules.

Module components

A module is a directory that contains the PHP and XML files (blocks, controllers, helpers, models) that are related to a specific business feature, such as Shipping. Specifically, a Magento module is composed of these software components: themes, libraries, and language packages.

Where do modules live?

Modules typically live in the vendor directory of a Magento installation, in a directory with the following PSR-0 compliant format: vendor/<vendor>/<type>-<module-name>, where <type> can be one of the following values:

  • module - for modules (module-customer-import-export)
  • theme - for frontend and admin themes (theme-frontend-luma or theme-adminhtml-backend)
  • language - for language packs (language-de_de)

For example, the Customer Import/Export module of Magento can be found at vendor/magento/module-customer-import-export.

But if you are creating a new module for distribution, you can just create the app/code/<vendor>/<type>-<module-name> directory and the required directories within it.

Inside this folder, you will find all the code related to this module, including the etc/module.xml file, which contains the name and version of the module, as well as any dependencies.

Working with modules

Magento developers, administrators, and anyone building a Magento web site will want to review all relevant topics surrounding their particular goals and use cases.

See PHP Developer Guide for specific instructions on extending modules.

See Frontend Developer Guide for information on implementing themes and other components.

Module dependencies

Modules and areas

Module location and naming conventions