Magento Kickstarter – Creates a skeleton for a new module

Stefan Wieczorek —  March 24, 2013 — Leave a comment

Magento Kickstarter

In my daily job as a Magento Developer i have to extend the standard functionality of magento.
The standard way of doing this is to write a module.
Over the last years i have developed more then hundret modules and it took me always 20-30 minutes to create the file system structure and all needed files to get a working module. I thought it would be useful for me and other magento developers to create such a skeleton within seconds.

Magento Kickstarter

We have launched the Kickstarter last december but unfortunately i was very busy to write a blog post about it.
Over the last 3 months a lot of modules have been created with our service which makes us very happy.

What files are created by the kickstarter?

Suppose we create a module “Mgt_Blog” which we need to extend another blog module.
After downloading and extracting the created module you will have a file system structure like this:

Magento Kickstarter - Created File System Structure

The config.xml

You are surprised certainly that there are some parts commented.
These parts are commented and can be used if you need the functionality.
For example if you want to create database tables you just need to uncomment the resources part
and magento will execute the sql file sql/mysql4-install-1.0.0.php

<?xml version="1.0"?>
<config>
    <modules>
        <Mgt_Blog>
            <version>1.0.0</version>
        </Mgt_Blog>
    </modules>
    <global>
        <blocks>
            <mgt_blog>
                <class>Mgt_Blog_Block</class>
            </mgt_blog>
            <mgt_blog_adminhtml>
                <class>Mgt_Blog_Block_Adminhtml</class>
            </mgt_blog_adminhtml>
        </blocks>
        <models>
            <mgt_blog>
                <class>Mgt_Blog_Model</class>
            </mgt_blog>
        </models>
        <helpers>
            <mgt_blog>
                <class>Mgt_Blog_Helper</class>
            </mgt_blog>
        </helpers>
        <!--
        <resources>
            <mgt_blog_setup>
                <setup>
                    <module>Mgt_Blog</module>
                </setup>
            </mgt_blog_setup>
        </resources>
        -->
        <!--
        <events>
            <catalog_product_load_after>
                <observers>
                    <mgt_blog>
                        <class>mgt_blog/observer</class>
                        <method>catalogProductLoadAfter</method>
                    </mgt_blog>
                </observers>
            </catalog_product_load_after>
        </events>
        -->
    </global>
    <frontend>
        <!--
        <routers>
           <mgt_blog>
               <use>standard</use>
               <args>
                   <module>Mgt_Blog</module>
                   <frontName>mgt</frontName>
               </args>
           </mgt_blog>
        </routers>
        -->
        <layout>
            <updates>
                <mgt_blog>
                    <file>mgt_blog.xml</file>
                </mgt_blog>
            </updates>
        </layout>
    </frontend>
    <!--
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Mgt_Blog before="Mage_Adminhtml">Mgt_Blog_Adminhtml</Mgt_Blog>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    -->
    <!--
    <crontab>
        <jobs>
            <mgt_blog_cron>
                <schedule>
                    <cron_expr>0,45 * * * *</cron_expr>
                </schedule>
                <run>
                    <model>mgt_blog/observer::methodName</model>
                </run>
            </mgt_blog_cron>
        </jobs>
    </crontab>
    -->
</config>

The technology behind

Such small projects are perfect to try something new.
For this little project i decided to use twitter bootstrap as powerful front-end framework
and the PHP micro-framework Silex.
I am big fan of symfony 2.0 and it’s components but symfony 2.0 is a little bit to much for such tiny application.
Silex seemed to be perfect, it’s lighweight, well documented and based on Symfony 2 Components.
The project uses twig as template engine and sqlite as database.

No Comments

Be the first to start the conversation.

Leave a Reply

*