diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php
index b76155a5a..3654cddd3 100644
--- a/src/Composer/Installer.php
+++ b/src/Composer/Installer.php
@@ -105,6 +105,7 @@ class Installer
protected $dryRun = false;
protected $verbose = false;
protected $update = false;
+ protected $runAutoloader = true;
protected $runScripts = true;
protected $ignorePlatformReqs = false;
/**
@@ -311,16 +312,18 @@ class Installer
}
}
- // write autoloader
- if ($this->optimizeAutoloader) {
- $this->io->write('Generating optimized autoload files');
- } else {
- $this->io->write('Generating autoload files');
+ if ($this->runAutoloader) {
+ // write autoloader
+ if ($this->optimizeAutoloader) {
+ $this->io->write('Generating optimized autoload files');
+ } else {
+ $this->io->write('Generating autoload files');
+ }
+
+ $this->autoloadGenerator->setDevMode($this->devMode);
+ $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
}
- $this->autoloadGenerator->setDevMode($this->devMode);
- $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
-
if ($this->runScripts) {
// dispatch post event
$eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
@@ -1152,6 +1155,21 @@ class Installer
return $this;
}
+
+ /**
+ * set whether to run autoloader or not
+ *
+ * @param boolean $runAutoloader
+ * @return Installer
+ */
+ public function setRunAutoloader($runAutoloader = true)
+ {
+ $this->runAutoloader = (boolean) $runAutoloader;
+
+ return $this;
+ }
+
+
/**
* set whether to run scripts or not
*