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


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.

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.