4

I've started to use Drupal 8 and some modules requires some libraries. For example search api solr. When I'm installing these libraries via composer it downloads the libraries into directory of the module. For example modules/contrib/search_api_solr/vendor. I don't think that it's correct because contrib modules should be stored in clean state.

What the right way to install libraries for modules via composer? Where should I store them?

1

2 Answers 2

5

Install Composer Manager, then you won't need to think about it:

Composer expects each project (Drupal installation, in our case) to have a single composer.json file listing all required packages. Composer Manager allows each contributed module to ship with its own composer.json file, listing the module-specific requirements. It then merges the requirements of all found modules into the consolidated composer.json file. This results in a single vendor/ directory shared across all modules which prevents code duplication and version mismatches.

1
  • 1
    The other approach is only using composer to download your modules. But this is easier if you already have your site and aren't that used to composer yet (which AFAIK also doesn't work yet without modifications). Either way, manually downloading is impossible, you have to use composer.
    – Berdir
    Commented Dec 14, 2015 at 22:07
2

Composer manager which was used with Drupal 7 is obsolete for Drupal 8 and should not be used with it. The right way to work with composer for with Drupal 8 is described here

2
  • Composer Manager is obsolete for Drupal 8. It is still applicable for Drupal 7 projects. Commented Mar 1, 2017 at 18:50
  • 1
    Maybe, but question was about Drupal 8 :)
    – Eugene
    Commented Aug 11, 2017 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.