3

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?

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
    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 Dec 14 '15 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

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

Please check the following link also

https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies

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.