Update: See https://www.drupal.org/project/composerize and https://github.com/grasmash/composerize-drupal for a better maintained projects than this one.

This is an experimental Drush extension that will generate a composer.json file from an existing Drupal project.


drush dl composer_generate

Usage: (Clone a site, no config--Drupal 7 only)

drush @site composer-generate > composer.json
composer install
cd htdocs
drush -y core-quick-drupal

Usage: (Create a new site using composer-project--Drupal 7 or 8)

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
cd some-dir
drush composer-generate @site
composer install
cd web
drush -y core-quick-drupal


If composer install fails with errors, you may need to fiddle with the generated composer.json file yourself until you arrive at a working version.


Only modules downloaded from drupal.org will be included in the composer.json file; for custom modules, and other modules taken from other sources, you will have to hand-edit the file and add in the appropriate repository and require entries.

The composer.json file that is generated assumes that the Drupal project root is located in a folder called 'htdocs'. If you want to use another layout, get a composer.json from another source (e.g. drupal-composer/drupal-project) and run drush composer-generate from the directory that contains the composer.json file.

Do NOT use this on the composer.json that comes with Drupal 8, or with the composer.json in the Drupal 8 core directory.

Work in progress; bugs may exist.

Project information

  • caution Seeking co-maintainer(s)
    Maintainers are looking for help reviewing issues.
  • caution No further development
    No longer developed by its maintainers.
  • Module categories: Drush
  • chart icon1 site reports using this module
  • shieldStable releases for this project are covered by the security advisory policy.
    Look for the shield icon below.