7

Let's say I have a module exposing a composer.json file, composer manager let me merge it with others modules composer.json.

In Drupal 8 composer.json are used from the core, so is it possible to avoid dependencies duplication with contrib modules ? Is composer-manager still used for that ?

1

At the moment this is not possible, and it does not look like this will make it into Drupal 8, as Drupal is in code freeze.

Instead, try to manage your dependencies using your module's *.info.yml file (this is for depending on other modules) or using http://drupal.org/project/libraries, which is for third party libraries.

To elaborate on why using Composer for Drupal 8 contributed modules is not a good idea right now:

  1. You cannot expect site builders to know composer and do a "composer install" after having downloaded Drupal to their computer, as Drupal is not just for people who are familiar with the command line.
  2. Because of that, you would have to do the composer install yourself and commit all code to your repository. While this is legally possible for any third party code that complies with the GPLv2, this makes maintenance harder, and if someone downloads two modules that both use the same library through Composer, they'll end up with duplicate code. This in turn makes class loading and debugging a whole lot less fun.

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.