I'am trying to install Drupal 7 using composer. Before that I tried to install drupal 8 using composer and it works perfectly.

Now when I try to install D7 using same method it is still installing D8 instead of D7. I set up package repository as mentioned here but still installing D8 only. I tried $ composer clearcache also but no difference. Please help. enter image description here

3 Answers 3


Checking https://packagist.org/packages/drupal/drupal for the versions available there is NO 7.x version. Drupal 7 has no composer.json for this to command to work.

You can use one of the other 2 methods mentioned on https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies

Using https://github.com/drupal-composer/drupal-project you need to tell the version

composer create-project drupal-composer/drupal-project:7.x-dev \
  test-3 --stability dev --no-interaction

Using https://github.com/hussainweb/drupal-composer-init you can do

composer drupal-init --drupal-7

Please note:

$ composer create-project drupal-composer/drupal-project:7.x-dev \
example --stability dev --no-interaction

This will copy the drupal-project to the example directory, and download Drupal core and some handy packages. This is a good point to cd into the example directory, run git init , and to then create your initial commit for your project.


Encountering this issue, in the process of upgrading a D7 site to D8, it took me a while to realize that there might be a slightly different question that often is more relevant:

How would one install D7 with modules, similarly to how one would install D8 with composer?

By using drush make was the answer for me. Unless I'm mistaken, that tool was contemporary with D7 to a much higher degree than composer was.

An easy way to get started is to install drush 8 (make is removed in newer versions) using composer, and then adapt drush/drush/examples/example.make.yml to your needs. For more details please see the documentation.

Clearly this is a bad idea for production systems, but that goes for creating new D7 instances today too.

Your Answer

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

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