Answers.Body: <p>With a little nudge from Brad, here's the answer:</p>
  
  <p>In order to get the module's composer dependencies taken into account in the parent site's composer dependencies, you need to add the module in the parent's composer.json, both as a require and as a repository with the path type, like so:</p>
  
  <pre><code>{
    ... a bunch of stuff from the default composer.json goes here ...
    "require": {
      "php": "&gt;=7.0.0",
      "craftcms/cms": "3.0.0-RC5",
      "vlucas/phpdotenv": "^2.4.0",
      "roave/security-advisories": "dev-master",
      "modules/modulename": "dev-master" &lt;-- add your module here (package name)
    },
    ... more stuff goes here ...
    "repositories": [
      {
        "type": "path",
        "url": "modules/modulename" &lt;--- and add it here (package path)
      }
    ]
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-01-17T00:03:17.990Z
Answers.LastActivityDate: 2019-05-03T00:56:55.010Z
Answers.LastEditDate: 2019-05-03T00:56:55.010Z
Answers.UserDisplayName: Jeremy Gimbel
Body: <p>I have a site-specific module in my modules directory that's being loaded in <code>config/app.php</code>. Since it won't be used elsewhere I am not storing the module in an external repository.</p>
  
  <p>When I added a <code>composer.json</code> file to load some dependencies for the module and ran <code>composer update</code>, it created a new vendor directory inside the module directory.</p>
  
  <p>Is there a way I can have a <code>composer.json</code> inside that module directory, but have the dependencies loaded in the main vendor directory?</p>
  
  <p>Or am I doing something totally wrong here?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-16T21:19:52.557Z
Comments.Text: If I'm following you correctly, can't you just set the `vendor-dir` config param of your module's composer.json file? https://getcomposer.org/doc/06-config.md#vendor-dir
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-16T22:01:04.080Z
Comments.Text: I guess what I'm getting at is that with a plugin that's been loaded via composer require, all the dependencies for the plugin get loaded automatically. I'm looking to get the dependencies for the module to bubble up to the whole project, so when I run composer update for the whole Craft install it automatically grabs the dependencies for the module as well, as it would for a plugin.
Comments.UserDisplayName: Jeremy Gimbel
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-16T23:54:10.800Z
Comments.Text: You should be able to add your module as a Composer dependency from your main composer.json (using [path](https://github.com/craftcms/docs/blob/master/en/plugin-intro.md#path-repository) since it's probably not public). Then `composer update`ing your main one should take the module and its dependencies into account.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-16T23:55:12.160Z
Comments.Text: Yup that did it.
Comments.UserDisplayName: Jeremy Gimbel
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-16T23:56:04.883Z
Comments.Text: Awesome... if you add that as an answer I'll give you 10 shiny new reputation points!
Comments.UserDisplayName: Brad Bell
Tags: <plugin-development><craft3><modules>
Title: How do I load composer dependencies for a Yii module that's in my site repo?
ThreadText: # How do I load composer dependencies for a Yii module that's in my site repo?
  
  (Asked by: username_0 on 2018-01-16)
  
  I have a site-specific module in my modules directory that's being loaded in `config/app.php`. Since it won't be used elsewhere I am not storing the module in an external repository.
  
  When I added a `composer.json` file to load some dependencies for the module and ran `composer update`, it created a new vendor directory inside the module directory.
  
  Is there a way I can have a `composer.json` inside that module directory, but have the dependencies loaded in the main vendor directory?
  
  Or am I doing something totally wrong here?
  
  **Tags:** plugin-development, craft3, modules
  
  > **Comments:**
  > **username_1**: If I'm following you correctly, can't you just set the `vendor-dir` config param of your module's composer.json file? https://getcomposer.org/doc/06-config.md#vendor-dir  
  > **username_0**: I guess what I'm getting at is that with a plugin that's been loaded via composer require, all the dependencies for the plugin get loaded automatically. I'm looking to get the dependencies for the module to bubble up to the whole project, so when I run composer update for the whole Craft install it automatically grabs the dependencies for the module as well, as it would for a plugin.  
  > **username_1**: You should be able to add your module as a Composer dependency from your main composer.json (using [path](https://github.com/craftcms/docs/blob/master/en/plugin-intro.md#path-repository) since it's probably not public). Then `composer update`ing your main one should take the module and its dependencies into account.  
  > **username_0**: Yup that did it.  
  > **username_1**: Awesome... if you add that as an answer I'll give you 10 shiny new reputation points!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-01-17. Score: 3
  
  With a little nudge from username_1, here's the answer:
  
  In order to get the module's composer dependencies taken into account in the parent site's composer dependencies, you need to add the module in the parent's composer.json, both as a require and as a repository with the path type, like so:
  
  ```
  {
    ... a bunch of stuff from the default composer.json goes here ...
    "require": {
      "php": ">=7.0.0",
      "craftcms/cms": "3.0.0-RC5",
      "vlucas/phpdotenv": "^2.4.0",
      "roave/security-advisories": "dev-master",
      "modules/modulename": "dev-master" <-- add your module here (package name)
    },
    ... more stuff goes here ...
    "repositories": [
      {
        "type": "path",
        "url": "modules/modulename" <--- and add it here (package path)
      }
    ]
  }
  
  ```
  
  
  ---
  
  