How to Create a Magento Extension
An introduction.
How to Create a Magento Extension with Magerun
Purpose:
- Thought it would fun to share how to make a simple Magento Extension, using a little tool called Magerun.
Requirements:
- Working Magento Store
- Command line access to the location where Magento is installed
Code Block Syntax:
- The $ represents the command line prompt.
- It is implied that we hit <enter key> for each command.
- The … means that the server responded with something.
Milestones:
- Install n98-magerun (for the easy road)
- Create skeleton extension
- Check to make sure Magento recognizes it.
Step 1. Get n98-magerun.phar (Github)
$ cd /path/to/your/magento-install
your/magento-install$ wget https://raw..../n98-magerun.phar
You should see a few lines… then some file transfer business… then:
... (138 KB/s) - `n98-magerun.phar' saved ...
Check if it’s in the right place:
$ ls | grep n98-magerun.phar
...
n98-magerun.phar
Great. Now let’s try it out:
$ php n98-magerun.phar -V
...
n98-magerun version 1.90.0 by netz98 new media GmbH
You should see: “n98-magerun version 1.90.0 by netz98 new media GmbH” Yay! We are on the right track.
Milestone 1 Reached!
Step 2. Create a skeleton extension
First step is to Choose a Vendor Namespace and a Module Name.
According to naming conventions, the Vendor Namespace and Module Name should be have the first letter capitalized and that is all. So for this tutorial let’s use “Bob” as our vendor, and “Scamper” as the Module.
$ php n98-magerun.phar dev:module:create Bob Scamper <enter>
...
Created directory: /vagrant/app/code/local/Bob/Scamper
Created directory: /vagrant/app/code/local/Bob/Scamper/etc
Created file: /vagrant/app/etc/modules/Bob_Scamper.xml
Created file: /vagrant/app/code/local/Bob/Scamper/etc/config.xml
Wonderful! These are the basic files needed for every extension.
Let’s do a little check to make sure Magento is registering the extension:
$ php n98-magerun.phar dev:module:list | grep Bob_Scamper <enter>
...
| local | Bob_Scamper | 1.0.0 | active |
Well done… You have officially made your first Magento Extension. It does absolutely nothing… but that’s ok.
Milestone 2 Reached!
Step 3. Check on Magento Backend
Now… just to check one more place… Let’s log into the Magento Backend.
Go to System > Configuration > Advanced > Disable Module Output:

Milestone 3 Reached!
Thanks for playing.
Let me know what you want the extension to do and we can work on it together. (https://www.codementor.io/drdouglasghd)