Magento

How Magento 2 identify module

Written by Payal Patel

Oct 10

How Magento 2 identify module

A module is a logical group – that is, a directory containing blocks, controllers, helpers, models – that are related to a specific business feature.

The purpose of a module is to provide specific product features by implementing new functionality or extending other modules’ functionality.

Each module is designed to function independently, so the inclusion or exclusion of a particular module does not typically affect other modules’ functionality.

Two possible locations to magento 2 identify module

app/code: If you build a module for a specific project, it is best to

choose the app/code folder and commit to the project’s repository.

vendor/<your_vendor>/module-somethingname: If you build a Magento 2 extension to be reused, it is better to use composer to create it, and put your module in the vendor/<your_vendor>/module-something folder.

There are two required files:

  • registration.php
  • module.xml

Step 1: The registration.php file inside the app/code/Dolphin with the following code.

<?php

use Magento\Framework\Component\ComponentRegistrar;

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

Step 2: The module.xml file inside the app/code/Dolphin/etc with the following code.

<?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="Dolphin_MyModule" />
</config>

Step 3: Run Magento Upgrade and Cache Clean command.

php bin/magento setup:upgrade
php bin/magento cache:clean

Now, go to app/etc folder open config.php file, and you can see your Dolphin_MyModule.

We hope our technical blog which looking is very effective for you. If any questions, please feel free to leave a comment below.

In the next tutorial, you will help How to create a basic module in Magento 2.

  • Magento 2.x
  • Magento developers

Written by Payal Patel

Our Magento Store

Do not miss a chance to grab exciting offers on Magento Development at Dolphin Web Solution. We are providing discounts on various Magento services this season. Go and grab yours today at our Magento Store.

Multiple Wishlist for Magento 2

Multiple Wishlist for Magento 2

₹ 3106

Wallet and Reward Points for Magento 2

Wallet and Reward Points for Magento 2

₹ 9476

RMA for Magento 2

RMA for Magento 2

₹ 11865

₹ 14254
Abandoned Cart Email for Magento 2

Abandoned Cart Email for Magento 2

₹ 6291

Simple Details on Configurable Product for Magento 2

Simple Details on Configurable Product for Magento 2

₹ 7883

₹ 9476
Frequently Bought Together for Magento 2

Frequently Bought Together for Magento 2

₹ 5494

₹ 7087

Let's Start Your Project

Get free consultation for your digital product idea to turn it into reality!

Copyright © 2023 DOLPHIN WEB SOLUTION. All rights reserved.

TO TOP