How is the class loader set to load the files containing classes?
For modules with composer dependencies in 7.x, try https://www.drupal.org/project/composer_manager. If you want to support modules with PSR-4 autoloading, see https://www.drupal.org/project/registry_autoload (integrates with the standard 7.x class loading registry) or https://www.drupal.org/project/xautoload.

That said, the code you pasted is just the APCu wrapper for the class loader. The actually relevant line is this, in \Drupal\Core\DrupalKernel::discoverServiceProviders():

$this-&gt;classLoaderAddMultiplePsr4($this-&gt;getModuleNamespacesPsr4($module_filenames));


What it does is register a PSR-4 namespace for each module with composer. Below that, everything follows the standard rules.

But composer dependencies is something else, that's handled automatically by composer's autoload.php and all the files that that then loads. Which is basically what composer_manager does, load the generated autoload.php file.