Why would I provide a composer.json for my modules? I’ve come across several Drupal7 modules that include a composer.json. It seems that this somehow influences how Drupal-CI determines test dependencies. Now I’m trying to find out whether it’s worth providing a composer.json at all in Drupal7 modules/themes maintained by me. I couldn’t find any hard facts about what exactly can be achieved by providing a composer.json, that’s why I’m looking for pointers to …


How does the presence of a composer.json affect processing in the Drupal-CI?
What other functionality is enabled by providing a composer.json file for Drupal7 modules (or themes)?


Note: There seems to be a lot of documentation about Drupal 8 / composer, but nothing specific for Drupal 7 / composer.



Here is a list of some Drupal7 modules with a composer.json:


currency: Specifies exclusively non-Drupal dependencies.
raven: Specifies exclusively non-Drupal dependencies
stringoverrides: Only  package metadata, no dependencies.
I wrote a blog that gives some case studies about when and why you would include a composer.json with your module: https://www.morpht.com/blog/drupal-and-composer-part-4-composer-drupal-developers

Basically it comes down to four things:


It allows your module to be managed with composer.
It allows your module to have it's Drupal module dependencies managed by composer
It allows your module to have it's 3rd party library dependencies managed through composer
Composer handles autoloading of namespaced classes in libraries it manages, meaning your module can use the 3rd party libraries it depends upon, without having to include any files


If none of the above requirements match your needs, then there is no reason to have a composer.json file in your module.