Module Installed in Root instead of Vendor

SilverStripe Version 4.2

In the root of a site I’m working on, I installed a module, with Composer, with the following command:

composer require lekoala/silverstripe-excel-import-export dev-master

After dev/build?flush, the module works, but was installed in the root folder, not the vendor folder, and is not contained within a folder with the author’s name. My understanding was that modules were installed in the vendor folder, with a structure like this /vendor/AUTHOR_NAME/MODULE_NAME. So, I expected to see /vendor/lekoala/silverstripe-import-export. But, instead, I have this: /excel-import-export

Is it apparent what I’ve done wrong? Have I done anything wrong, or is this behavior due to the module itself? I’m not sure how to diagnose this.

It’s up to module authors whether or not they get installed to the vendor folder. In SilverStripe 3.x all modules were installed to the webroot. In SS4 most modules have been updated to reside in the vendor directory instead. The key difference is in the composer.json file of the module:

# Installs in to project root
"type": "silverstripe-module"
# Installs in to vendor directory
"type": "silverstripe-vendormodule"

So you haven’t done anything wrong!

Is it possible to ‘relocate’ that module to the vendor directory? After digging a bit more, I did notice that that particular module also installs one of its dependencies, phpoffice/phpspreadsheet, into the /vendor directory, which follows the SS4 convention you mentioned. Is it just that the install location of the module, itself, hasn’t been updated to reflect this change from SS3 to SS4?