In my experiments with Magento 2 composer packages, I've been able to get a package up and running without using composer's type attribute.

However, this class file

#File: vendor/magento/framework/Composer/ComposerInformation.php
const THEME_PACKAGE_TYPE = 'magento2-theme';

 * Magento2 module type
const MODULE_PACKAGE_TYPE = 'magento2-module';

 * Magento2 language type
const LANGUAGE_PACKAGE_TYPE = 'magento2-language';

 * Magento2 metapackage type
const METAPACKAGE_PACKAGE_TYPE = 'metapackage';

 * Magento2 library type
const LIBRARY_PACKAGE_TYPE = 'magento2-library';

 * Magento2 component type
const COMPONENT_PACKAGE_TYPE = 'magento2-component';

hints at the fact there's times where Magento 2 is parsing composer.json files, and looking at the type attribute.

Does anyone know where/why Magento 2 does this, with an eye towards figuring out if type is a required attribute or not for general (i.e. non Marketplace) distribution of extensions?

2 Answers 2


now that the magento composer installer does not need to do special operations anymore with a magento component package (because of the registration mechanism), this should not be required anymore (it defaults to "library" which just installs the package to the vendor dir).

It would still be needed if, for some reason, you would like to install a module the "old" way, by letting the composer installer copy the files to the desired directory. The type then decides where the files are copied to.

It is actually still used at one point for listing the components here: https://github.com/magento/magento2/blob/4cae5d058b7ad877b2ec7d2b6fa0a500f7c16860/setup/src/Magento/Setup/Controller/ComponentGrid.php#L118

My guess is that this is only for rendering the modules list in the setup process

UPDATE: it may be also used for the update mechanism over the magento backend


yes, type is required for Marketplace. As the other answer says, the type determines what actions are possible using Component Manager.

We also strongly recommend that if you're developing an extension that has more than one component, you package it as a metapackage and pay attention that shared components must be designated as such in the Marketplace.

IOW, if you have a module that is shared by 2 metapackages, the module must be designated as shared in Marketplace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.