You are here

function composer_manager_register_autoloader in Composer Manager 7.2

Same name and namespace in other branches
  1. 6.2 composer_manager.module \composer_manager_register_autoloader()
  2. 6 composer_manager.module \composer_manager_register_autoloader()
  3. 7 composer_manager.module \composer_manager_register_autoloader()

Registers the autoloader for all third-party packages.

Return value

\Composer\Autoload\ClassLoader() The ClassLoader instance.

3 calls to composer_manager_register_autoloader()
composer_manager_boot in ./composer_manager.module
Implements hook_boot().
composer_manager_sa_vulnerabilities in composer_manager_sa/composer_manager_sa.module
Find any known vulnerabilities in a composer.lock file.
drush_composer_manager_update_autoloader in ./composer_manager.drush.inc
Add new autoloader paths to the Class Loader.

File

./composer_manager.module, line 166
Provides consolidated management of third-party Composer-compatible packages required by contributed modules.

Code

function composer_manager_register_autoloader() {
  static $registered = FALSE;
  $autoloader = composer_manager_vendor_dir() . '/autoload.php';
  if (!$registered) {
    if (!file_exists($autoloader)) {
      $message = t('Autoloader not found: @file', array(
        '@file' => $autoloader,
      ));
      throw new \RuntimeException($message);
    }
    $registered = TRUE;
  }
  return require $autoloader;
}