Where to create custom extensions for Magento2?
You can look at the folders app/code
and vendor
as the codepools in M1, but they are not really codepools.
There is no "codepool" concept in M1.
vendor
folder is for modules you download via composer. You should not write code in that folder.app/code
is your playground. Add your own extensions here.
If you need to rewrite/extend something in the vendor
folder you can do it in the app/code
folder. Just make sure you specify the soft dependency in the module.xml
of your module, in the same way you did it in M1 in app/etc/modules/Namespace_Module.xml
file.
The only difference is that in m2 they are not actually dependencies. They are sequences.
This way your module will be loaded after the one from the vendor
folder
app/code
is definitely the right place for the modules of your projet.
You must never write code inside vendor
(this directory is not ignored into your source control), since it is managed by composer only and is dedicated to third party module or module you want to reuse (and you have published on packagist or your own satis repository).