Monday 7 November 2016

Magento2 Directory Structure

I have gone through the directories of Magento2 and i and i found that directory structure changed . It is important to understand differences between Magento1.x and Magento2. In tis blog we will discuss about Magento2 Directory and Files structures.

Root Folder Structure

First let’s compare root folder structure of Magento 1.x and Magento 2. There are major changes applied at root level. Very first thing you will identify is that some new folders are introduced and some of them are removed.
  • media and errors folder are moved to pub folder
  • skin and js folder are moved to pub/static folder. Now it is easy to maintain static content via CDN.
  • js, css, images are again divided into pub/static/adminhtml and pub/static/frontend for backend and frontend area respectively.
  • dev folder contains various tools for developers such as migration tools and tests. shell is moved to dev folder
  • downloader, includes and pkginfo folder are no more with magento 2.
  • setup directory is for installation process
  • get.php, cron.php and index.php files are moved to pub folder.

There are 2 index.php files one in Magento root folder and another in pub folder. You can configure your server to run your application through any of this index.php file. Using pub/index.php is a good option as it will stop access of application files and it is good for security.

eav.php

Database connection settings, backend name, session save settings and cache settings are declared in app/etc/env.php
config.php
config.php has list of active and inactive modules
Theme Folder Structure
Magento 2 comes with very drastic changes on the frontend. Significant changes has been apply on theme structure for performance improvements.
As like earlier version magento 1.x base package ‘app/design/frontend/base/’ will no more exists. Each core module in Magento 2 has new folder introduced which is called ‘view’. This ‘view’ folder contains all module specific files like email template, js, layout xmls, phtml for frontend and backend.
Themes are grouped by ‘vendor’ which we known as ‘package’ in magento 1.x. Theme structure in Magento 2 is like ‘app/design/frontend/vendor_name/theme_name’.

Core Module
Magento core components are exists in your_magento_web_root/vendor/magento directory.
Module Folder Structure
In Magento 2 app/etc/modules folder is removed and module’s declaration is moved to app/code/Vendor_name/Module_name/etc/module.xml file. Each module has its own registration.php file in its root. This file is for Magento to identify it as a module.
app/code/core, /local, /community folders are removed and module structure becomes like
[root]/app/code/[Namespace]/[Module]
  • Namespace is a name of a module’s vendor
  • Module is a name assigned to a module by its vendor
Next to Controller, Model, Helper, Block, etc Magento 2 has introduced new folders which are:
  • Api
  • i18n – contains module specific translation
  • view – contains module specific layout xmls, phtml


Click Here If you want to join Magento Training in Delhi

No comments:

Post a Comment