What are the different Composer package types in Magento 2?

Magento system uses Composer packages to distribute, install, and upgrade components in an application.

composer-magento

Table below shows all the package type used in the Magento.

Friendly name composer.json `type`
Metapackage metapackage
Module magento2-module
Theme magento2-theme
Language package magento2-language

Sample composer.json from Magento system as follows :

Metapackage

Technically, a Composer package type, not a Magento component type. A metapackage consists of only a composer.json file that specifies a list of components and their dependencies. For example, both Magento Open Source and Magento Commerce are metapackages. (Reference Magento DevDocs)

{
    "name": "sudhanshu/module-main",
    "version": "1.0.0",
    "type": "metapackage",
    "require": {
        "sudhanshu/module-abc": "1.0.0",
        "sudhanshu/module-xyz": "1.0.0"      
    }
}

Module Package

/vendor/magento/module-msrp/composer.json file for module

{
    "name": "magento/module-msrp",
    "description": "N/A",
    "require": {
        "php": "~7.0.13|~7.1.0",
        "magento/module-store": "100.2.*",
        "magento/module-catalog": "102.0.*",
        "magento/module-downloadable": "100.2.*",
        "magento/module-eav": "101.0.*",
        "magento/module-grouped-product": "100.2.*",
        "magento/module-tax": "100.2.*",
        "magento/framework": "101.0.*"
    },
    "suggest": {
        "magento/module-bundle": "100.2.*",
        "magento/module-msrp-sample-data": "Sample Data version:100.2.*"
    },
    "type": "magento2-module",
    "version": "100.2.3",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "Magento\\Msrp\\": ""
        }
    }
}

Theme Package

/vendor/magento/theme-frontend-blank/composer.json for theme

{
    "name": "magento/theme-frontend-blank",
    "description": "N/A",
    "require": {
        "php": "~7.0.13|~7.1.0",
        "magento/framework": "101.0.*"
    },
    "type": "magento2-theme",
    "version": "100.2.5",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

Language Package

/vendor/magento/language-en_us/composer.json for language

{
    "name": "magento/language-en_us",
    "description": "English (United States) language",
    "version": "100.2.0",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/framework": "101.0.*"
    },
    "type": "magento2-language",
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *