How do I manage modules via composer in a multisite architecture? For example, if I want one site to have version 2.3 of a module, and another to have version 2.4, how do I do this?

Do I have a composer file in each site that can inherit from the composer file in the parent Drupal application?

1 Answer 1


Short answer: you cannot do it The (new Drupal) Composer Way™ (still).

The composer is mostly project-oriented, however, based on the fact that they are projects of the projects, there is a chance that a composer.json could be made that would operate on a subsite level.

As far as we can go would be to hope that something will be done in the coming 9.2 release, somewhere south of Spring 2021. Until then, workaround and search for the best practices and other experiences (however sparsely) seems the only way

#2847218: Improve documentation around the multisite functionality

The (temporarily and incomplete) solution:

The only thing you are left with is to use the composer for the common, shared modules and to use drush or manually download modules and themes according to Drupal multisite structure:

-- sites
   -- site1
         -- modules           ----> site specific modules
            -- custom
            -- contrib
         -- themes            ----> site specific themes
            -- custom
            -- contrib
         -- files

Beside official documentation, you can read this post too: Drupal Multisite Setup: Are There (Still) any Valid Reasons to Use It? Should It Get Removed in Drupal 9.x?

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.