Craft Plugins require that a "type":"craft-plugin"
property is defined in each composer.json
file. Composer refers to this to help manage and install the plugin. Craft Modules do not currently have this support.
You can see all package types that Composer Installer supports here. There is still a way to achieve what you're trying to do though...
Composer Installers Extender allows you to create your own custom package type. So we could create craft-module
ourselves. Just make sure your module has this "type":"craft-module"
in it's composer.json
Now we can define some extra
settings that tell Composer to put the modules into the modules directory. Incorporate the following into your projects composer.json
file:
"require": {
"oomphinc/composer-installers-extender": "^1.1",
"vendorname/modulename": "dev-master"
},
"autoload": {
"psr-4": {
"modules\\": "modules/",
"modules\\modulename\\": "modules/modulename/module/"
}
},
"extra": {
"installer-types": ["craft-module"],
"installer-paths": {
"modules/{$name}": ["type:craft-module"]
}
},
Note: Make sure your module no longer exists in your vendor directory as you may be hit with some potential conflict warnings.