plugin dev with vendor packages 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, 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?
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.