Include Drupal modules inside composer.json file 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!
There are general two kind of dependencies you can make in a composer file.


Other Drupal modules
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.