Set up the Composer autoloader.

@throws \Bolt\Exception\PackageManagerException
14350
private function setupAutoloader()
    {
        $this->io->title('Updating autoloaders');
        $result = $this->app['extend.action']['autoload']->execute();
        $this->outputResult($result);
    }
374740
private function setup()
    {
        $loader = new FilesystemLoader(GeneratorHelper::getTemplatePath());
        $this->tpl = new Environment($loader, array(
            'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig',
            'debug' => (bool)$this->debug,
            'auto_reload' => Config::getParam('twig.autoreload', TRUE),
        ));
        $this->loadDomains();
    }
267648
protected function composerInstall() {
    if (!$this->getConfigValue('deploy.build-dependencies')) {
      $this->logger->warning("Dependencies will not be built because deploy.build-dependencies is not enabled");
      $this->logger->warning("You should define a custom deploy.exclude_file to ensure that dependencies are copied from the root repository.");

      return FALSE;
    }
    $this->say("Rebuilding composer dependencies for production...");
    $this->taskDeleteDir([$this->deployDir . '/vendor'])
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
    $this->taskFilesystemStack()
      ->copy($this->getConfigValue('repo.root') . '/composer.json', $this->deployDir . '/composer.json', TRUE)
      ->copy($this->getConfigValue('repo.root') . '/composer.lock', $this->deployDir . '/composer.lock', TRUE)
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
    $command = 'composer install --no-dev --no-interaction --optimize-autoloader';
    if ($this->ignorePlatformReqs) {
      $command .= ' --ignore-platform-reqs';
    }
    $this->taskExecStack()->exec($command)
      ->stopOnFail()
      ->dir($this->deployDir)
      ->run();
  }
460210
public function boot()
    {
        // use the vendor configuration file as fallback
        $this->mergeConfigFrom(
            __DIR__.'/config/config.php', 'dick.backupmanager'
        );

        // use this if your package has views
        $this->loadViewsFrom(realpath(__DIR__.'/resources/views'), 'backupmanager');

        // use this if your package needs a config file
        $this->publishes([
                __DIR__.'/config/config.php' => config_path('dick/backupmanager.php'),
        ], 'config');
    }
420278
protected function setupComposerPackages()
    {
        $platform = $this->getPlatformInstance();

        if ($platform instanceof ComposerPackageInterface) {
            $platform->alterComposer($this->composer);
        }
        $this->saveComposer();

        return $this;
    }
1208495
protected function setupComposer()
    {
        $composer_file = $this->getComposerJsonFile();
        $contents = json_decode(file_get_contents($composer_file), true);
        if (!isset($contents['autoload']['files'])) {
            // Cria a seção files
            $contents['autoload']['files'] = [];
        }

        $autoloader_file = $this->getAutoloaderFile();
        if (array_search($autoloader_file, $contents['autoload']['files']) === false) {
            // Adiciona o arquivo com prioridade
            $contents['autoload']['files'] = array_merge(
                [$autoloader_file],
                $contents['autoload']['files']
            );
        }

        $json_contents = str_replace("\\/", "/", json_encode($contents, JSON_PRETTY_PRINT));
        if (file_put_contents($composer_file, $json_contents) === false) {
            $this->getObfuscator()->addErrorMessage("Could not update composer.json file");
            return false;
        }

        $this->getObfuscator()->addErrorMessage("O arquivo composer.json foi configurado com sucesso.");

        return true;
    }
1188087
public function registerAutoloader()
    {
        $this->app->afterResolving(DocumentManagerRegistry::class, function (ManagerRegistryInterface $registry) {
            /** @var DocumentManager $manager */
            foreach ($registry->getManagers() as $manager) {
                Autoloader::register(
                    $manager->getConfiguration()->getProxyDir(),
                    $manager->getConfiguration()->getProxyNamespace()
                );

            }
        });
    }
714677
public function onBeforeAutoloadDump() {

    // FIXME Composer call this AFTER the plugin remove, so we need this check to prevent a fatal error
    clearstatcache();
    if( file_exists( __DIR__ . '/Plugin.php' ) ) {

      //
      $filesystem = new Filesystem();
      $tmp        = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
      array_unshift( $tmp, $this->composer->getPackage() );

      $list = [];
      foreach( $tmp as $package ) {
        if( $package->getType() == static::PACKAGE_TYPE ) {

          // choose root directory based on the path (absolute path has no root) or package (main or vendor)
          if( $package === $this->composer->getPackage() ) $directory = $this->root;
          else $directory = $this->getDirectory( $package );

          // process autoloader
          $autoload = $package->getAutoload();
          if( isset( $autoload[ 'psr-4' ] ) ) {
            foreach( $autoload[ 'psr-4' ] as $namespace => $path ) {

              // don't handle multi directory namespace
              if( is_array( $path ) ) $this->io->writeError( 'Spoom\Composer: Ignoring multiple psr-4 namespaces of ' . $package->getPrettyName() );
              else {

                // normalize and ensure the trailing slash in the path
                $list[ $namespace ] = $filesystem->normalizePath( ( $filesystem->isAbsolutePath( $path ) ? '' : $directory ) . $path ) . '/';
              }
            }
          }
        }
      }

      $this->io->write( 'Spoom\Composer: Generating autoload file for ' . count( $list ) . ' extension(s)' );

      // create autoload file from the package list
      $this->writeAutoload( $list );
    }
  }
191562
private function setup()
    {
        self::$version = '3.1.7';
        self::$src = dirname(__FILE__);
        self::$dir = dirname(dirname(__FILE__));
        self::$url = $this->getCuztomUrl(self::$src);

        // Do
        do_action('cuztom_setup');
    }
922947
private static function _init()
	{
		//Set environment up for composer
		ini_set('memory_limit', '1024M');
		if (getenv('COMPOSER_HOME') != PATH_APP)
		{
			putenv('COMPOSER_HOME=' . PATH_APP);
		}
		if (getcwd() != PATH_APP)
		{
			chdir(PATH_APP);
		}
		// Assume no need for output from composer
		if (!self::$io)
		{
			self::$io = new NullIO();
		}

		// Set up a composer object
		if (!self::$factory)
		{
			self::$factory = new Factory();
		}

		if (!self::$composer)
		{
			self::$composer = self::$factory->createComposer(self::$io, PATH_APP . '/composer.json', false, PATH_APP, true);
		}
		return true;
	}
601290
protected function setThemeAutoloading()
    {
        foreach ($this->config->get('theme.autoloading', []) as $ns => $path) {
            $path = $this->dirPath.'/'.trim($path, '\/');
            $this->loader->addPsr4($ns, $path);
        }

        $this->loader->register();
    }
1066774
protected function setupManager()
    {
        $factory = new ConnectionFactory($this->container);

        $this->manager = new DatabaseManager($this->container, $factory);
    }
726176
protected function setupObject()
    {
        // Clean key from special characters not allowed in constant names
        $this->key = rtrim(preg_replace('/(\W|_)+/', '_', $this->getAttribute("key")), '_');
        $this->className = $this->getAttribute("class");
        $this->pkg = $this->getAttribute("package");
        $this->ancestor = $this->getAttribute("extends");
    }
927815
public function SetupPackages() {

		$halted = false;

		foreach($this->Packages as $pkg) {
			try { $pkg->Setup($this); }
			catch(Exception $e) {
				$this->ShowMessage($e->getMessage());
				$halted = true;
			}
		}

		if($halted) $this->ShowMessage('Operation aborted.');
		else $this->ShowMessage('Operation complete.');

		return $this;
	}
726827
protected function loadManager()
    {
        if (null === $this->getManager()) {
            $manager = new Manager($this->getConfig(), $this);
            $this->setManager($manager);
        } else {
            $manager = $this->getManager();
            $manager->setCommand($this);
        }
    }
278640
private function setup()
    {
        $this->runner = $this->specHelper->getRunner();

        $this->setupWorkspace();
        $this->setupTargets();

        // call initializers
        foreach ($this->application->config('spec.initializers.*') as $initializer) {
            $initializer($this->application);
        }
    }
515240
private function setup()
	{
		$composer_psr4 = dirname(dirname(dirname(__DIR__))).'/composer/autoload_psr4.php';
		if (!file_exists($composer_psr4)) {
			exit("\nI can't find Composer data!");
		}

		$composer = require_once $composer_psr4;
		if (!isset($composer['Config\\'][0])) {
			exit("\nI can't find Composer data!");
		}

		//APP_CONFIGPATH defined in "index.php" or in bootstrape
    	if(!defined('_CONFIGPATH')){
      		define('_CONFIGPATH', isset($composer[''][0]) //Composer fallBack
		       ? $composer[''][0].'/Config' 
		       : dirname($vendorDir).'/Config');
    	}
    	static::$configDir = _CONFIGPATH;
    	static::$vendorDir = $vendorDir;
    	static::$baseDir = defined('_PHPPATH') ? _PHPPATH : dirname($vendorDir);
	}