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 etc/module.xml file
Create etc/module.xml file with the next content:
PHP
1 2 3 4 5 | <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="MageDirect_ModuleExample" setup_version="0.1.0"/> </config> |
Create registration.php file
PHP
1 2 3 4 5 6 | <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'MageDirect_ModuleExample', __DIR__ ); |
Enable the module
Enable the module by running next commands :
PHP
1 2 | php bin/magento module:enable MageDirect_ModuleExample php bin/magento setup:upgrade |
All is done!
Now you can check your module status:
PHP
1 | php bin/magento module:status |
Also, look at the official documentation:
http://devdocs.magento.com/videos/fundamentals/create-a-new-module/
After reading the article need to consult with creating a new product type?
MageDirect Team is ready to help you!
Lilya GogolevaMagento Developer
Rate us
Please wait...
Related articles
- Follow this tutorial to clear Magento cache with no efforts. Also, you will...
- This easy and effortless tutorial on how to create the new admin account in...
- If you don’t know how to create a custom cache type in Magento, this article...
- SSL is very important for every online store as it initiates a secure session...
- The sitemap is highly important in case you want to optimize your website for...
- Want to manage email templates in your Magento 2 store? Check our article and...
- Do you know how to create custom product type? We know! And would be glad to...
- Want to have a Magento 2 Multistore? Read how our team setups...