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.
Installation:
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
Troubleshooting
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.
Limitations:
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
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.No further development
No longer developed by its maintainers.- Created by greg.1.anderson on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.

