I'm looking for an explanation of the app/code/[vendor] and vendor/[vendor] directories? (For M2.1)

Some online sources (such as inchoo) say to put a new module in app/code/[vendor], yet in 2.1 there is no such directory, and modules are conspicuously in vendor/[vendor]. Meanwhile the official doc page on the Magento file system say "information will be added later".

Which is correct? What's the history -- did this change at some point? Can I read docs that refer to app/code and just do the same thing in vendor/?


4 Answers 4


Magento 2 advocates the use of composer for managing modules, when you install a module through composer it is added to vendor/<vendor-name>/<module>.

You should not edit any code inside the vendor folder. If you’re developing your own module or if you want to continue development of an existing module you add your files or clone a git repo to app/code/<vendor-name>/<module>.

If you later want to distribute this custom module you initialize a git repo and create a composer package. Now others will be able to download and install your module as a composer package, in their <vendor> folder.

  • Thanks for explaining that the vendor folder is the target of composer installation (and later reinstallation), which is the reason not to do manual work in that branch of the file system. That goes a long way to settling by mind as to why app/code is the place to do manual ad hoc development.
    – gwideman
    Nov 15, 2016 at 1:25
  • I have a module i want to use i put on app/code/Company/ModuleName but this module as some dependencies. If i log into this folder and do composer install the "vendor" folder is inside this . but It is not detected. Where should i add the dependencies Nov 20, 2020 at 12:28

Take note that in Magento 2x, You should not touch the vendor folder because the core modules of magento resides in that folder. and if you modify a single code or module in that folder, and you are planning in the future to upgrade your magento to the latest version available. You will experience a major problem because when you upgrade magento 2. Those codes or module that you edited in the vendor folder will give a conflict to the new version. The best thing you can do is extend a vendor module for you to be safe. and if your magento installation has no app/code folder. you can manually add it.

The correct way of creating or extending a module is to create it under app/code/vendorname/modulename you can refer to this link: https://www.mageplaza.com/magento-2-module-development/

Hi guys correct me if I'm wrong. but as far with my experience in magento 2. vendor module should not be touched.

Thank you, MazeStricks

  • app/code/VENDORNAME/MODULENAME is correct sructure, not app/code/VENDRNAME_MODULENAME. Note that it is a subdirectory, and not one directory for all modules of one VENDORNAME. Nov 10, 2017 at 13:25

I (the original poster) later stumbled on this word from the horse's mouth:


An excerpt:

Here are some key directories to try and clarify their roles:

  • app/design is where to locally develop a theme to have it picked up during development.
  • vendor is where things go if you get a "released" package from somewhere (Marketplace, or internally) - Composer downloads into this area.
  • pub/static is where files are generated from the theme. These are the files the web browser downloads. All fallback rules, theme inheritance, etc is all resolved by this stage.

... and there's quite a bit more in that same comment, and subsequent Q&A comments.


All core module located at vendor/magento folder

Our developed extension we need to place it to app/code folder

You are right there is no vendor directory. Here vendor means your custom module name. As an example your module name Test_HelloWorld then you have to create below directory and your Test_HelloWorld module code place into it.

  • On my magento 2.1 installation there's no code directory in the [magentoroot]/app folder. There IS however a [magentoroot]/vendor/ folder, in which there are many vendors' specific folders. One of these is: [magentoroot]/vendor/magento/... containing all of magento's modules. Also within [magentoroot]/vendor/ are about 25 other vendor subfloders containing their modules. That's why I say that it looks to me like [magentoroot]/vendor/ is the place to put modules.
    – gwideman
    Nov 14, 2016 at 6:26
  • You have to create code directory in code directory in app folder and place all module in it. Nov 14, 2016 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.