There's something I've been thinking about from the point of view of developer experience, in a way that kind of relates to issues like #1920666: Allow additional external libraries with composer. I've been writing some test modules that require dependencies from Composer that aren't provided in Drupal 8. The issue of getting those dependencies installed cleanly is another story, but right now I'm concerned that the current method of setting up the autoloader for it is kind of hacky.
Right now, the only way I can get external libraries included is by callingrequire_once DRUPAL_ROOT . '/core/vendor/autoload.php';
at the top of my module file, before I define any hooks.
I've been thinking that there's got to be a cleaner way to do this. Has anyone explored the possibility of including the Composer autoloader at the same time the core autoloader is set up?
Alternatively, is there any way to tell the module (say in the .info.yml file) that it should refer to the Composer autoloader as well as the main one, without having to include boilerplate at the top of your module file?
If there is some consensus on what should be the right kind of way to do this, I could have a go at writing up a patch.
Might be related:
#1818628: Use Composer's optimized ClassLoader instead of Symfony's
#1955386: Load autoload.php in hook_boot/hook_init?