I've seen a lot of tutorials on how to create a custom module in Magento. But all of them are mostly those helloworld examples.

I'm wondering what files do we actually have to create in order to just create a module that's been reckognized by the system.

What are the only important files that have to exist for the module? I'm thinking that only confing.xml and namespace_Modulename.xml are needed for a new module and everything else is like extra for that (example showing stuff on the page etc).

  • If you only add one file namespace_Modulename.xml the system will recon it as a module and will show it on System > Config > Advanced
    – John
    Commented Jun 27, 2017 at 7:57

3 Answers 3


Magento 1 answer

You are right... all you need to get your module loaded are:

  • app/etc/modules/My_Module.xml
  • app/code/pool/My/Module/etc/config.xml

Magento 2 answer

For Magento 2, the only files needed for a Module are:

  • app/code/Vendor/ModuleName/registration.php
  • app/code/Vendor/ModuleName/etc/module.xml

These are their contents:


namespace Vendor\ModuleName;

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Vendor_ModuleName', __DIR__);


<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_ModuleName" setup_version="0.0.1" />

For Magento 2, You will need only these two files for developing a module :


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_HelloWorld" setup_version="1.0.0">



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.