Simple Magento Extension generator

Writing Magento modules on a everyday basis can become extremely boring job when it comes to the part where you define your module directories, config file, model, block, helper, etc. What I am trying to say is that there is significant amount of repetitive work being done each time you start new module development. To compensate for this a little bit, I created this little Magento module that helps you create other modules. Hope it does not sound to much confusing.
To access the module functionality you need to install by copy-pasting the content of archive to your Magento installation and then open the http://mystore.loc/alpha url. I realize that using “alpha” for the module name is not much innovative. Basically you can look at this module as being a skeleton upon which you might build your own module generator. The code itself was done in a hasty way so it might need some refactoring if you wish to play with it. I plan on continuing my work on this module. This is just an alpha version :).
So, what does this module do actually? When you access the http://mystore.loc/alpha url you will be presented with a very simple form where you can enter the company name and module name. Please know that the attached version of module is not “fool proof” so try not to use any spaces or small-big letters combination for names. Once you click create, you should be presented with another page that offers you a link on which you can click and download the generated module.
Also, module generates the root “/generated” folder in which you can find both subdirectories and .tar file of the generated module.
There are several files that get generated as a part of a module. Most important is config.xml file, so be sure to take a good look at it and change the values manually to your convenience.
Hope it helps someone.
Download Inchoo_Alpha.
NOTE: Do not use this on production site.
Cheers.
15 comments
Thanks it work fine for me Thanks Inchoo for creating such a nice extension and Thanks Ignacio Pascual for giving a good solution
Hello Abhijit Patel,
Please Explain me how to use module creator i am not understand how to use the module creator
vinay singh
vinaysingh43@gmail.com
Please try it
http://www.silksoftware.com/magento-module-creator
I saw an interesting solution recently. A number of magento extensions and magento private sales theme. Maybe you’ll find it valuable for yourself.
You can see here: http://www.private-sales-v20.plumrocket.net/
I’ve create a service to do this. you have http://www.generateplugin.com/. It’s not free but you can use search engine, url rewriting and it’s not only your skeleton which is generated, it’s all your module with your admin etc… It’s my personnal tool since a lot of time. Pierre.
I have downloaded and place Inchoo alpha module. how i will run this module? please help me
You have a bug in Inchoo_Alpha_Model_Alpha on line 165. Should extend Mage_Core_Model_Mysql4_Collection_Abstract, not Mage_Core_Model_Mysql4_Abstract.
I had to modify Alpha/Model/Alpha.php
line 52: @mkdir(getcwd().’/generated’);
line 59: @mkdir(getcwd().’/generated/’.$companyName.’_’.$moduleName.’/app/etc’);
line 310:
$writer->startElement(“setup”);
$writer->text(“\n\t\t\t\t\t”);
$writer->startElement(“module”);
$writer->text($companyName.”_”.$moduleName);
$writer->endElement();
$writer->text(“\n\t\t\t\t”);
$writer->endElement(); /* setup */
To make sure the config.xml has
Test_Module
core_setup
…instead of
Test_Module_Model
core_setup
…which it didn’t execute the mysql-setup script.
I hope that helps!
Inchoo thanks again for all you do to the community! Croatia rulez!!!
Nice.
I altered it to use store/var/generated instead store/generated because I generally keep my store directory unwritable by the server.
@B00MER I based mine on that extension… using the same “blank” or “skel” directory.
That module is compatible with Magento 1.3, and the theme layout of that version. I’m going to be updating it for 1.4 when I get the chance.
@All
Just do not expect to much out of this module (for now), it was coded in under 2h, so it’s Alpha of an Alpha 🙂
Yeah there are several module creators out there but I think I’ll give this one a go – I’m impressed by the work Inchoo do with Magento.
http://www.magentocommerce.com/magento-connect/Daniel+Nitz/extension/1108/modulecreator
Is this similar to the above?
I have something similar that I’ve just created, but it’s a shell script instead of a Magento plugin. You run it from the command line and it creates a .tar.gz file containing all of the components for your module, which you can untar onto your Magento install.
It is also alpha, so no guarantees, but I’d be happy to accept bugfixes and suggestions.
http://github.com/mitc0185/Magento-Module-Creator
Thanks Branko, it really cuts off the time needed for such a boring part of the job 😉