How to Create Module in Magento 2

To create a new module in Magento 2, we need to follow next steps:

Create module folder

Create module folder within app/code with VendorName_ModuleName name, in our example, it will be MageDirect_ModuleExample


create module


Create etc/module.xml file

Create etc/module.xml file with the next content:

Create registration.php file

Enable the module

Enable the module by running next commands :

All is done!

Now you can check your module status:

Also, look at the official documentation:

Was this article helpful?
Dislike 0
Views: 45
Lilya Gogoleva

Lilya GogolevaMagento Developer

Rate us
1 Star2 Stars3 Stars4 Stars5 Stars
(5 votes, average: 4.80 out of 5)
Bottom Top