How to create simple module magento2
Here we go to create your first or very simple module in magento2. We are going to create module with Namespace is "Jwd" and Module Name is "WelcomeWorld". Step1: Create a module.xml file in app/code/Jwd/WelcomeWorld/etc/module.xml [sourcecode language="plain"] <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Jwd_WelcomeWorld" setup_version="1.0.0"> </module> </config> [/sourcecode] Step2: Create app/code/Jwd/WelcomeWorld/registration.php [php] <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Jwd_WelcomeWorld', __DIR__ ); ?> [/php] Step3: Create a frontend router in app/code/Jwd/WelcomeWorld/etc/frontend/routes.xml [sourcecode language="plain"] <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="standard"> <route id="welcomeworld" frontName="welcomeworld"> <module name="Jwd_WelcomeWorld"/> </route> </router> </config> [/sourcecode] Step4: Create the file index.php for controller action in app/code/Jwd/WelcomeWorld/Controller/Index. This will map to http://127.0.0.1/magento2/welcomeworld/index/index welcomeworld: front name index: name of controller folder index: name of action file – index.php Each action is its own class extending \Magento\Framework\App\Action\Action. In every action file,…