Magento 2: Where do Third Party Modules Go?

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 a registration.php file which are used to get the module into the system. You also need the etc/modules.xml file. This is, technically, all it takes to register a module:

$ tree app/code/Alger/
app/code/Alger/
└── Skeleton
    ├── composer.json
    ├── etc
    │   └── module.xml
    └── registration.php

2 directories, 3 files

To get the module up and running, you need to run setup:upgrade and then cache:flush for the system to both recognize and load your new component:

$ bin/magento module:enable Foo_Bar
$ bin/magento setup:upgrade -q && bin/magento cache:flush -q

Update: Two methods to install module from public GitHub repo: https://gist.github.com/davidalger/77761f13d9752b117f35


Alan, they still go in app/code. Make sure you have a registration.php in the modulename folder containing the following:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Namespace_Modulename',
    __DIR__
);

Then run:

php bin/magento setup:upgrade

Just tested on fresh Magento 2 CE release and works properly.