I just installed the first official release of Magento 2. I was surprised to find that the app/code
folder was gone
app/code
This was for both the version downloaded from the website and the version installed via composer. Also, when I tried to manually create the app/code
folder, and then do a php bin/magento module:enable Pulsestorm_MyModule
to enable a sample module, I got the following error
Unknown module(s): 'Pulsestorm_MyModule'
Where are third party modules supposed to live? If the answer is "a source repository and installed via composer", how does a module developer need to structure their modules to live in a Magento 2 repository?
Best Answer
Preferably 3PLs will live in the vendor directory along with everything else. However… :) We all know there is typically custom code written for almost every custom site-build out there, and this IMO belongs in app/code/ still. Yes, you can still run a module from app/code.
All modules, regardless of location, should have a
composer.json
and aregistration.php
file which are used to get the module into the system. You also need theetc/modules.xml
file. This is, technically, all it takes to register a module:To get the module up and running, you need to run
setup:upgrade
and thencache:flush
for the system to both recognize and load your new component:Update: Two methods to install module from public GitHub repo: https://gist.github.com/davidalger/77761f13d9752b117f35