The directory structure within Magento 2 has changed compared to earlier versions of Magento.
Learning the locations of the files and folders in Magento 2 might take some time, however there are similarities with the Magento 1 structure.
If you have downloaded Magento from the Magento website, the root directory will look like the following.
Within the app
directory consists the following directories and files.
code
directory where you will place any third party code not installed via Composer, or your own custom modules. The Magento core code has been moved into the vendor
directory.design
directory that contains an adminhtml
and frontend
directory.
adminhtml
directory is used for creating adminhtml themes.frontend
directory is used for creating frontend themesetc
directory that contains two important files:
env.php
that contains environment configuration such as database, cache and session information.config.php
that contains a PHP array of active and inactive modules.The bin
directory contains:
magento
executable that is used to run common commands such as clearing the cache, running the database upgrade and deploying static content.Within the dev
directory:
The lib
similar to Magento 1 contains library files.
internal
directory that contains the Libertine font files.web
directory that contains multiple directories of assets such as CSS, images and JavaScript files.phpserver
:
router.php
file for the php built-in web server.The pub
folder is the preferred document root for the Magento application.
index.php
file within this directory rather than within the root directory.media
directory contains generated static files and media images uploaded.setup
:
The update
directory:
The var
directory, similar to Magento 1:
And lastly, the vendor
directory is created via the use of composer
commands.
Composer
. Any third party libraries such as Zend Framework that are installed this way are also present in this directory. Code edits should not be made in any files within the vendor
directory as they will get overridden when installing or updating packages.That covers an overview of the directory structure within Magento 2. With this information you’ll be able to create a module and custom theme to help you get started with using the application.
Note: This article is based on Magento version 2.1.