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.
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:
<?php use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register( ComponentRegistrar::MODULE, 'Dolphin_MyModule', __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="Dolphin_MyModule" /> </config>
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.
In Magento
Apr 02, 2023
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.