Magento : How To Create A First Hello Module

You can create a simple custom module in Magento to add your custom functionality to your Magento website.

Please find the steps below to create a simple hello module:

1) First Create an XML file using “Namespace_Module.xml” in the “app/etc/modules/” directory which registers your module in Magento.

Ex. Lekhraj_Myfirstmodule.xml containing the following code snippet:

<?xml version=”1.0″?>

2) Next you need to create a module configuration file as config.xml which tells that what a module does.

File location: app/code/local/Lekhraj/Myfirstmodule/etc/config.xml


<?xml version=”1.0″?>

3) Create a controller to access our module in frontend with url as “”

File location: app/code/local/Lekhraj/Myfirstmodule/controllers/IndexController.php

In the above url, after index.php, there is moduleName/controllerName/actionName which calls your module.

class Lekhraj_Myfirstmodule_IndexController extends Mage_Core_Controller_Front_Action
public function indexAction()
echo “Hello test World”;

Finally, just hit the url as “” and see the text “Hello test World”. That’s it your module is ready.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s