How to composer autoload within a drupal 8 custom module

Viewed 655

How to autoload "non drupal" classes like Carbon when required via the modules own composer.json without altering drupals core composer.json (like using the composer-merge-plugin)? Where do I have to include composers autoload.php to use the third party libraries within MyModuleController?

My module structure (simplified)

src/
  MyModuleController.php
vendor/
  autoload.php
  ...
composer.json
composer.lock
my_module.info.yml
my_module.module
1 Answers
Related