what is module and how to Create



What is module :-

=> Module is a structural element of Magento 2 – the whole system is built upon modules. Typically, the first step in creating a customization is building a module. ... Run the bin/magento setup:upgrade script to install the new module. Check that the module is working.


How to Create Module:- 

=> Follow this is step and create the module

1) First you go to app/and create the code folder.

2) Create the module_vendor_name/module_name folder.

3) Create the etc/module.xml file. 

4) Create the registration.php file. 

5) Run the bin/magento setup:upgrade script to install the new module.

6) Check that the module is working.


Let's go through each of these steps in detail.

Go to your magento 2 root. Open the app folder and create new code folder. 

Create the module_vendor_name/module_name folder. Like app/code/Mage/Mohit.

Create the etc/module.xml file. your module root app/code/Mage/Mohit/etc/module.xml. And this some code your module.xml file 

<?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="Mage_Mohit" setup_version="1.2.9"/>
</config>

Create the registration.php file. your module root app/code/Mage/Mohit/registration.php. And this file use use registration your custom module in magento. Write some code

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mage_Mohit',
    __DIR__
);


>  After Run the bin/magento setup:upgrade. This command use is  registration your module. 

php bin/magento setup:upgrade

Check your module name in command line 


Showing module name in command line.So your module is perfect working.


Thanks ... 

Comments