Please note this article is currently a work in progress!
What are modules?
Modules provide all the core functionality Magento offers that builds on top of the framework code and also the way for developers to add their own extended functionality to the platform.
As their name suggests they are modular collections of code designed to work independently from one another, or in many cases, depend on other modules and extend their functionality.
A module can contain many different types of code for a wide variety of purposes, which we'll cover below.
Generally speaking, small, concise modules with minimal dependencies make for better code maintainability and interpolation, but in the Magento core modules can range from micro to monolithic.
Core Magento 2 module examples
Magento_Catalog- contains all key functionality in relation to products and categories (and more!)
Magento_Checkout- contains all key functionality in relation to the cart and checkout process
Magento_Cms- contains all key functionality in relation to CMS pages and blocks
Note all the Magento modules above contained 'Magento', followed by an underscore then a descriptive word relating to the module (e.g. 'Checkout'). These form a modules name, broken down as follows:
<Vendor> is the name of the module provider / creator and
<ModuleName> is the name of the module.
So, for example a module that adds image banners to CMS pages by a company called 'My Awesome Company' might be named
By default, modules can be included in 2 places within a Magento 2 project:
- Within the
- Within the
vendordirectory (this is where all modules installed via composer reside)
Create `registration.php` file
'MageQuest_MyFirstModule', __DIR__ );\Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE,
Create `etc/module.xml` file
What files are required for a module?
i.e. the minimum files needed to register / enable a module