Create a Custom Magento Module

Magento Custom Module

Magento will provide all feature but sometimes we want to extend Magento basic function or class, make some content based extension (plug-In) or make some website(ex. e-bay, Amazon), application(ex. payment method, shipping method) integration for Magento 2.

How to make Custom Module ?, Which file is required?, Where to put in Magento root folder?

Magento is a bunch of many modules. specific features have own module in Magento like for product module name “module-catalog”. Custom Module Structure is same like Magento default module structure.
In custom module three file is required.
1) registration.php
2) etc/module.xml
3) composer.json (required if module want to install using SSH.)

Sample File of all Required Files.



Module.xml File is register module when deploy a magento. module.xml put in etc folder. “etc” folder located in Custom module root directory. In code is there, it means your module will be executed after tis module.


<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="CodeWithGeek_Custom" setup_version="1.0.0"></module>
            <module name="Magento_Backend"/>
             <module name="Magento_Sales"/>
            <module name="Magento_Quote"/>
            <module name="Magento_Checkout"/>


    "name": "codewithgeek/custom",
    "description": "CodeWithGeek Custom",
    "require": {
      "php": "~5.6.0|7.0.2|~7.0.6",
      "magento/magento-composer-installer": "*"
    "type": "magento2-module",
    "version": "0.74.0-beta4",
    "license": [
    "extra": {
        "map": [