What is Module in Magento 2

The module is an independent component. It is logical to the group – that contains blocks, controllers, helpers, models, etc – that are related to a specific business feature. It allows bringing additional features for the e-commerce store which is based on Magento 2.

Module are two locations where a module can be located in Magento 2

An app/code directory is the first location. This directory used for all custom and 3rd party modules.

A vendor directory is the second location. If you build an extension to be reused, it is better to use the composer to create it and put your module in this folder.

Let’s create a vendor directory inside the app/code/Vendor/ directory, let’s create a module directory.

There are two required files: registration.php and module.xml

– The registration.php file inside the app/code/Vendor/Module with the following code.

– The module.xml file inside the app/code/Vendor/Module/etc with the following code.

How to register a Module?

Now, the last step is run the command which will enable and install the Vendor_Module module.

php bin/magento setup:upgrade

Module has been added and enabled in a Magento 2 application. You can check in app/etc/config.php file.
The value 1 means the module is enabled, and 0 that means the module is disabled. If Vendor_Module the module is set to 1, which means that the module has been successfully registered in a Magento 2.

2 responses to “What is Module in Magento 2”

  1. Shiyalo Avatar
    Shiyalo

    I’ll bookmark your blog and test once more right here regularly.

    I am relatively certain I’ll learn much new stuff proper right
    here! Good luck with my best wishes!

    1. Payal Patel Avatar
      Payal Patel

      Thank you so much for reading our blog.

      Hope this blog is useful for you.

      You can find another new blog, If you need any help then you can contact us.

CynoInfotech

CynoInfotech was founded in 2019, in Ahmedabad, Gujrat. we have a trusted Web Development and Design Company that helps businesses in streamlining their operations through Magento 2 Extension and advanced modern technology solutions.

Let’s connect