0

I am doing a custom code of OpenSocial template/site.

In OpenSocial or other composer file, there are some modules that are added in the "require": {} section and they are installed properly when running the file.

Ex.

   "drupal/entity": "1.0-alpha4",
   "drupal/features": "3.5",

My question is how can I install module that requires to run composer for it to be properly working?

My goal is to include Simple Oauth in the composer file. I can just do this, but is there any additional input outside the file?

"drupal/simple_oauth": "2.0-rc1",

Also I noticed that when adding the Address module in the require section, there is some lines added here, for example.

I am new to this method and I really appreciate your help! Thanks!

1 Answer 1

2

There are general two kind of dependencies you can make in a composer file.

  1. Other Drupal modules
  2. PHP/JS/FOO libraries

If your module depends on a specific library, you should do like the address module and make sure that the library is present when it's being installed, so you can prevent installation if the library is not available. It's a clever way of making sure you don't install the module in a broken setup, which could cause fatal errors etc.

IF you simply depend on other drupal modules, you should also add the dependency in the info file which should be enough.

1
  • thank you so much for that explanation. :D I find it so helpful. Thanks! Commented May 15, 2017 at 12:10

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.