Magento Module Section
Module located in ‘App/code/Vendor_Name/Module_Name’ or using composer located in ‘Vendor/Vendor_Name/Module_Name’.
In Vendor_Name/Module_Name these section is included…
- API: New API interface class or extended api interface class of core magento 2.
- Block: PHP files of blocks. block PHP file is to collect data from the model and use in PHTML. In the layout file, we also declare a support block for PHTML.
- Console: PHP classes for CLI (Command Line Interface) calls. Need to create this class when in the module we create some extra command who handle module operation by SSH.
- Controller: Controller is defined as Two types. Who route in Magento admin that define in ‘Controller/Adminhtml’ directory & route in frontend that defines in ‘Controller’ directory. controller template URI is normally defined as uri_1/uri_2/Controller. uri_1 & uri_2 is define in module’s route.xml.
- etc: This directory contains two directory frontend & adminhtml. In this directory module.xml is required file for creating a module, also config.xml, di.xml, ack.xml, and Cron’s XML files are also included in etc, frontend or adminhtml directory as per requirement.
- Helper: Auxiliary classes. these classes access in controller, block and in PHTML.
- i18n: Language Pack CSV is uploaded here. Like de_DE/de_DE.csv.
- Model: models, model resources are defined. A model who collects data and interact with View. Resource model is the connection between MySql and Model.
- Services: These sections contain many Directory. Directory’s list is Observer, Plugin & UI.
- Observer: Observer Directory contains an event class. Magento has many predefined events so some module wants to use event then define in etc/di.xml and their classes are in Observer.
- Plugin: Plugin’s PHP file who’s extended version of Magento core Module, Controller & Block’s file.
- Ui: Required UI Components of a module.
- Setup: This directory contains database files.
- InstallSchema.php: Create Database
- InstallData.php: Installation Data (Customer’s, Category’s, Product’s attributes)
- UpgradeSchema.php: Update Database
- UpgradeData.php: Update Data (Customer’s, Category’s, Product’s attributes)
- Test: This Directory contains Test Data of Module.
- View: Template( PHTML, HTML), CSS, js, media file. As usual, This directory contains divide into Adminhtml, Frontend & Base (Applied for both Adminhtml, frontend) Directory. This Directory is used to collect user input and display data according to the user’s data.
- registration.php: This file is required for a module.
- composer.json: This file is required if a module is installed by the Composer. this JSON schema is contained the dependent module, module version, PHP version and other require module and system.