function drush_autoload

8.0.x bootstrap.inc drush_autoload($commandfile)
6.x bootstrap.inc drush_autoload($commandfile)
7.x bootstrap.inc drush_autoload($commandfile)
master bootstrap.inc drush_autoload($commandfile)

Used by a Drush extension to request that its Composer autoload files be loaded by Drush, if they have not already been.

Usage:

function mycommandfile_drush_init() { drush_autoload(__FILE__) }

File

includes/bootstrap.inc, line 1170
Drush bootstrapping code.

Code

function drush_autoload($commandfile) {
  $dir = dirname($commandfile);
  $candidates = array("vendor/autoload.php", "../../../vendor/autoload.php");

  foreach ($candidates as $candidate) {
    $autoload = $dir . '/' . $candidate;
    if (file_exists($autoload)) {
      include $autoload;
    }
  }
}