Happy to see you guys again!

In this blog post, we will learn how to create Magento 2 extension step by step and basic knowledge required to setup a module. we will also introduce the coding of Magento 2 in the form of a “Hello Developer” style. This blog post also includes some basic functionality, covering as many development aspects as possible in this case.

Lets consider module with Namespace is Magewallet and Module Name is HelloDeveloper. Lets list down all the files require for this extension.


First we will create registration file at app/code/Magewallet/HelloDeveloper/registration.php file

Now, create a composer.json file in app/code/Magewallet/HelloDeveloper/ folder as per below.

now create module.xml file in app/code/Magewallet/HelloDeveloper/etc

Create a frontend router in app/code/Magewallet/HelloDeveloper/etc/frontend/routes.xml

here the router ID shown which router we will use either frontend or adminhtml. Pay attention that the front name is the first part of the URL and it should be unique.

Create a Controller action

Create the file index.php in app/code/Magewallet/HelloDeveloper/Controller/Index.

Create a layout file at app\code\Magewallet\Helloworld\View\frontend\layout\hellodeveloper_index_index.xml

Create block file app/code/Magewallet/HelloDeveloper/Block/HelloDeveloper.php

Create a template file app/code/Magewallet/HelloDeveloper/View/frontend/templates/hellodeveloper.phtml

Active Magewallet_HelloDeveloper extension

Open Command line in folder root of Magento and run commands

In order to cross check the routing and controller access below URL.

You have known all the steps to write a simple extension in Magento 2. if you have any questions about this steps of Magento 2 extension development, please ask them in comments.
Enjoy Magento 2! Enjoy Magewallet!!

Mahendra Paladiya
Mahendra is a Web Developer whose passions includes web development, technical blog writing, and database management. His passion for web development pushed him into learning how to handle different platforms like Core PHP, Magento, Prestashop, WordPress, CodeIgniter, CakePHP and Oracle.