Should the version number in custom module's module.xml and composer.json be the same?


<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Company_Mymodule" setup_version="1.0.5" />


    "name": "Company\/Mymodule",
    "require": {
        "php": "~5.5.0|~5.6.0"
    "type": "magento2-module",
    "version": "1.0.5",

In core modules I see their different, but I'm not sure what are the consequences.


1 Answer 1


They probably should match, but they don't have to.

The module.xml number is used for Magento setup and upgrade script versioning. If that number increases, you have to run the setup process, and Magento will execute the Setup/Upgrade* scripts during that.

The composer.json number is for dependency checking during composer updates. Magento doesn't look at this number directly (for the most part).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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