Magento2 : Admin Module

Magento2 Directory Structure: 

Root Directory Structure Of Module:
NameSpace/ModuleName
├── Block
├── Controller
├── Model
├── Setup
├── Ui
├── etc
├── view
├── registration.php

etc directory structure.
To Create etc File Visit  etc Structure .
NameSpace/ModuleName/etc
├── adminhtml
            ├──menu.xml
            ├──routes.xml
├── acl.xml
├── di.xml
├── module.xml

Controller directory structure.
To Create Controller File Visit  Controller Structure 
NameSpace/ModuleName/Controller
├── adminhtml
            ├──foldername
                                ├──ControllerName.php

A controller receives a request from end-user:
URL : DOMAIN_URL/route_name/foldername/ControllerName
route_name :  is a unique name which is set in routes.xml as frontName.
foldername : is the folder inside Controller folder.
ControllerName : is a class with execute method to process the request.

Model directory structure.
To Create Model File Visit  Model Structure .
NameSpace/ModuleName/Model
├── FolderName
          ├──ModelName.php
├── ResourceModel
├──ModelName.php
├──ModelName
├──Collection.php

Setup directory structure.
To Create Setup File Visit  Setup Structure .

NameSpace/ModuleName/Setup
├── InstallSchema.php
├── InstallData.php
├── UpgradeSchema.php

view directory structure.
NameSpace/ModuleName/view
├── adminhtml
            ├──layout
            ├──templates
            ├──web
            ├──js
├──css

registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'NameSpace_ModuleName',
    __DIR__
);

Comments