Answers.Body: <p>I figured it out. <code>composer update</code> in my Craft directory was not seeing the new required package in my plugin's composer.json file. I'm assuming this was based on specified versions or not bumping the version so that it would update the plugin package.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-23T05:18:04.953Z
Answers.Text: It depends on how you included your plugin into Crafts composer json. When you insert a specific version there it won't recognize newer versions beyond
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-23T11:20:03.993Z
Answers.Text: Yeah, that seemed to be the issue. Thanks again for replying!
Answers.UserDisplayName: Mark J. Reeves
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-23T01:22:17.903Z
Answers.LastActivityDate: 2018-04-23T11:20:15.627Z
Answers.LastEditDate: 2018-04-23T11:20:15.627Z
Answers.UserDisplayName: Mark J. Reeves
Answers.Body: <p>You should not do that at all. The entire process to install plugins via composer instead of the old way is to avoid this conflict. Imagine two of your plugins require the same class/library so you'll end up with a <code>class already declared</code> exception. Instead you can insert your requirements into the composer json of your plugin, run the <code>composer update</code> command for your Craft composer json and you are fine.</p>
  
  <p>All dependencies will be loaded into the correct <code>vendor</code> folder. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T22:19:48.200Z
Answers.Text: Thanks for the reply! You've said what I "should not" do, but what you say I can do is what I did...and it didn't work. Bear in mind I did not yet install the plugin, it's being referenced by symlink per the docs, while in development. I'm trying to understand how to work on a plugin in that mode, without installing it, and without installing the dependency directly.
Answers.UserDisplayName: Mark J. Reeves
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T19:13:34.143Z
Answers.LastActivityDate: 2018-04-22T19:13:34.143Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I haven't seen any answers specifically addressing this. While I did find a workaround, there's a bit of a gap in knowledge or guidance on this one, it seems.</p>
  
  <p>I'm developing a plugin as prescribed in the <a href="https://docs.craftcms.com/v3/plugin-intro.html#composerjson" rel="nofollow noreferrer">Craft Docs</a>, where my plugins folder is outside of my Craft folder:</p>
  
  <p><code>
    "minimum-stability": "dev",
    "prefer-stable": true,
    "repositories": [
      {
        "type": "path",
        "url": "../dev/craft-campaignmonitor-transactional"
      }
    ]
  </code></p>
  
  <p>This is working great! After seeing a bunch of code work I ran <code>composer require</code> in my plugin to add a required package there, and it installed in my <code>vendor</code> directory for my plugin.</p>
  
  <p>No matter what I tried, though, I kept getting "Class not found" errors for that package's class when I tried to use it in my plugin code.</p>
  
  <p>Only when I ran <code>composer require</code> on the package in my <strong>Craft</strong> directory did it work in my plugin.</p>
  
  <p>I can understand why this is happening...but should I be able to work on a plugin outside the Craft directory and keep vendor packages out of the Craft directory until I'm ready to install it? Or is this a necessary workaround while in development?</p>
  
Tags: <plugin-development><craft3><composer>
Title: plugin dev with vendor packages
ThreadText: # plugin dev with vendor packages
  
  (Asked by: username_0 on 2018-04-22)
  
  I haven't seen any answers specifically addressing this. While I did find a workaround, there's a bit of a gap in knowledge or guidance on this one, it seems.
  
  I'm developing a plugin as prescribed in the [Craft Docs](https://docs.craftcms.com/v3/plugin-intro.html#composerjson), where my plugins folder is outside of my Craft folder:
  
  `"minimum-stability": "dev",
  "prefer-stable": true,
  "repositories": [
  {
  "type": "path",
  "url": "../dev/craft-campaignmonitor-transactional"
  }
  ]`
  
  This is working great! After seeing a bunch of code work I ran `composer require` in my plugin to add a required package there, and it installed in my `vendor` directory for my plugin.
  
  No matter what I tried, though, I kept getting "Class not found" errors for that package's class when I tried to use it in my plugin code.
  
  Only when I ran `composer require` on the package in my **Craft** directory did it work in my plugin.
  
  I can understand why this is happening...but should I be able to work on a plugin outside the Craft directory and keep vendor packages out of the Craft directory until I'm ready to install it? Or is this a necessary workaround while in development?
  
  **Tags:** plugin-development, craft3, composer
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-04-23. Score: 0 | Accepted answer
  
  I figured it out. `composer update` in my Craft directory was not seeing the new required package in my plugin's composer.json file. I'm assuming this was based on specified versions or not bumping the version so that it would update the plugin package.
  
  > **Comments:**
  > **username_1**: It depends on how you included your plugin into Crafts composer json. When you insert a specific version there it won't recognize newer versions beyond  
  > **username_0**: Yeah, that seemed to be the issue. Thanks again for replying!  
  
  ---
  
  ### Answer by username_1 on 2018-04-22. Score: 1
  
  You should not do that at all. The entire process to install plugins via composer instead of the old way is to avoid this conflict. Imagine two of your plugins require the same class/library so you'll end up with a `class already declared` exception. Instead you can insert your requirements into the composer json of your plugin, run the `composer update` command for your Craft composer json and you are fine.
  
  All dependencies will be loaded into the correct `vendor` folder.
  
  > **Comments:**
  > **username_0**: Thanks for the reply! You've said what I "should not" do, but what you say I can do is what I did...and it didn't work. Bear in mind I did not yet install the plugin, it's being referenced by symlink per the docs, while in development. I'm trying to understand how to work on a plugin in that mode, without installing it, and without installing the dependency directly.  
  
  ---
  
  