How to create basic hello-world module from scratch in Magento 1.8 and 1.9


In this tutorial for beginner, we will learn how to create basic Helloworld Magento module from scratch. There are 2 steps to be done:

– Declare module

– Create folders of module

Now, let’s start to build your very first Magento extension!

1. Declare module in Magento

First, we need to create config.xml file in app/etc/modules/Magentoexplorer_Helloworld.xml, in this tutorial, my package is Magentoexplorer and module’s name is Helloworld (I will explain more later)

Now, put the following code in config.xml:

To check if the module is properly displayed in Magento backend, go to System > configurations > Advanced > Advanced > Disable Modules Output

2. Create folder structures of Module

In order to create a Magento module, you should create the following folder structure

build basic magento hello world module

Please note that capitalization of directories and files are very important. You should name directories and files exactly as above.Otherwise, the module will not work properly and show the text “Hello”

After finishing directory structure, we will create the following files and put inside those directories.

First, create config.xml in app/code/local/Magentoexplorer/Helloworld/etc/config.xml, the file contains the following code

The code above will notify Magento system about the code that will run, frontend node declare router in front-end.

Now, enter this link to your browser localhost/magento/helloworld (magento as root directory) and see the result.

Error? It’s alright, it’s due to the router we declared above could not find controller. What we need to do now is create controller for our module

Create  indexController.php in app/code/local/Magentoexplorer/Helloworld/controllers/IndexController.php

We created a class that is extended from  Mage_Core_Controller_Front_Action , class Magentoexplorer_Helloworld_IndexController  is named according to file path (this is Magento’s rule).

3. Run your module for the first time

Now, try to re-enter the link localhost/magento/helloworld in your browser and check the result!

Yay, you will see: Hello World, 

helloworld module magento

Congratulation, you’ve just created your first Magento module Helloworld.

If you want to enter other actions like: add, edit, delete, you just need to add  index/action_name (zend framework rule:”name_function+Action”), for example: localhost/magento/helloworld/index/add

So, what are block, helper, model folders? Well, we will explain more in the next part, you will also learn how to create layout for your extension.

If you have any troubles, download the module I created here: Helloworld_magento_module by
We hope our tips will be useful for beginning working with Magento. Please do not hesitate to ask us any additional questions or add your feedback.

How to create basic hello-world module from scratch in Magento 1.8 and 1.9
5 (100%) 1 vote


About Author

Brian is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer


  1. Thank you for this sweet tutorial, I have successfully made my very first Magento module from scratch. Please keep posting tutorial about Magento module.

  2. Hello,

    for some reason I’m getting “index function” on a white screen and that’s it. I have double checked the code – everything is like in your tutorial.

    Best regards,

  3. Hi, It was awesome tutorial, But i got the message displayed in Blank Page, currently am using magento 1.9 version. I can understand that procedure for 1.9 is slight different than your tutorial. Can you expand this concept to further like how to display as in screen shot in Magento 1.9 version.

    Thanks in advance 🙂

Leave A Reply