Called whenever composer (re)generates the autoloader.

Recreates Skinny plugin path map, based on composer information
and available app-plugins.

@param Event $event the composer event object.

@return void
510188
public static function postAutoloadDump(Event $event)
    {
        $composer = $event->getComposer();
        $config = $composer->getConfig();

        $vendorDir = realpath($config->get('vendor-dir'));

        $packages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
        $pluginsDir = dirname($vendorDir) . DIRECTORY_SEPARATOR . 'plugins';

        $plugins = static::determinePlugins($packages, $pluginsDir, $vendorDir);

        $configFile = static::configFile($vendorDir);
        static::writeConfigFile($configFile, $plugins);
    }
618460
public function afterStore(Event $event) {
		$this->pathBuilder($event->getSubject()->pathBuilder());
		$this->subject = $event->getSubject();

		$this->autoProcessImageVersions($event->getData('entity'), 'create');
	}
12034
public static function install( \Composer\Script\Event $event )
	{
		$repository = $event->getComposer()->getRepositoryManager()->getLocalRepository();

		if( ( $t3package = $repository->findPackage( 'aimeos/aimeos-typo3', '*' ) ) === null
			&& ( $t3package = $repository->findPackage( 'typo3-ter/aimeos-typo3', '*' ) ) === null
		) {
			throw new \RuntimeException( 'No installed package "aimeos/aimeos-typo3" or "typo3-ter/aimeos-typo3" found' );
		}

		$installer = $event->getComposer()->getInstallationManager();
		$t3path = $installer->getInstallPath( $t3package );

		if( ( $package = $repository->findPackage( 'aimeos/ai-client-html', '*' ) ) !== null )
		{
			$event->getIO()->write( 'Installing Aimeos public files from HTML client' );

			$path = $installer->getInstallPath( $package );
			self::copyRecursive( $path . '/client/html/themes', $t3path . '/Resources/Public/Themes' );
		}

		if( ( $package = $repository->findPackage( 'aimeos/ai-typo3', '*' ) ) !== null )
		{
			$event->getIO()->write( 'Creating symlink to Aimeos extension directory' );

			$path = dirname( $installer->getInstallPath( $package ) );
			self::createLink( '../../../../../../' . $path, $t3path . '/Resources/Private/Extensions' );
		}
	}
1186656
public function onPreAutoloadDump(Event $event)
    {
        $basePath = $this->getBasePath($event);
        $lockPath = "{$basePath}/pre.lock";

        $shouldOptimize = $this->shouldOptimize($event);

        if ($shouldOptimize) {
            file_put_contents($lockPath, time());

            if (!file_exists("{$basePath}/vendor/autoload.php")) {
                return;
            }

            require_once "{$basePath}/vendor/autoload.php";

            $directory = new RecursiveDirectoryIterator($basePath);

            $files = new RecursiveIteratorIterator(
                $directory, RecursiveIteratorIterator::SELF_FIRST
            );

            foreach ($files as $file) {
                if (stripos($file, "{$basePath}/vendor") === 0) {
                    continue;
                }

                if ($file->getExtension() !== "pre") {
                    continue;
                }

                $pre = $file->getPathname();
                $php = preg_replace("/pre$/", "php", $pre);

                compile(
                    $pre, $php, $format = true, $comment = false
                );
            }
        } else {
            if (file_exists($lockPath)) {
                unlink($basePath . "/pre.lock");
            }
        }
    }
1021037
public function postLoad(LifecycleEventArgs $event)
    {
        $entity = $event->getEntity();

        if (! ($entity instanceof Menu)) {
            return;
        }

        $builder = $this->builderRegistry->getBuilder($entity->getType());
        $entity->setBuilder($builder);
    }
749417
public function installHooks(Event $event) : void
    {
        $event->getIO()->write('CaptainHook Composer Plugin');
        if (!$this->isCaptainHookInstalled()) {
            // reload the autoloader to make sure CaptainHook is available
            $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
            require $vendorDir . '/autoload.php';
        }

        if (!$this->isCaptainHookInstalled()) {
            // if CaptainHook is still not available end the plugin execution
            // normally this only happens if CaptainHook gets uninstalled
            $event->getIO()->write(
                '  <info>CaptainHook not properly installed try to run composer update</info>' . PHP_EOL .
                PHP_EOL .
                'If you are uninstalling CaptainHook, we are sad seeing you go, ' .
                'but we would appreciate your feedback on your experience.' . PHP_EOL .
                'Just go to https://github.com/CaptainHookPhp/captainhook/issues to leave your feedback' . PHP_EOL .
                PHP_EOL .
                '<comment>WARNING: Don\'t forget to deactivate the hooks in your .git/hooks directory.</comment>'
            );
            return;
        }
        Cmd::setup($event);
    }
750795
private function captureStepEvent(Event $event)
    {
        if ($event instanceof AfterStepTested) {
            $this->afterStepTestedEvents[$event->getStep()->getLine()] = $event;
        }
        if ($event instanceof AfterStepSetup) {
            $this->afterStepSetupEvents[$event->getStep()->getLine()] = $event;
        }
    }
587333
public static function configureProject(Event $event)
    {
        DirectoryConfigurator::fromEvent($event)->run();
        BundleConfigurator::fromEvent($event)->run();

        // Install assets here since they they were skipped above
        static::installAssets($event, false);
    }
1256738
public static function postAutoloadDump(Event $event): void
    {
        $event->getIO()->write('<info>    Packages Auto-Discovery [Executed]</info>');
        $vendorPath = $event->getComposer()->getConfig()->get('vendor-dir');
        $manifestPath = $vendorPath . '/../bootstrap/cache/packages.php';

        self::discoverPackages($vendorPath, $manifestPath);
    }
1067729
public function autoRequirePackagesPreUpdate(Event $event)
    {   
        $companyPackages = [];
        $packages = $this->composer->getPackage()->getRequires();
        foreach($packages as $packageName => $package) {
            if($this->startsWith($packageName, $this->vendorName)) {
                $companyPackages[$packageName] = $package;
            }
        }
        $repository = $this->composer->getRepositoryManager();
        foreach($companyPackages as $packageName => $package) {
            if($repository->findPackage($packageName, '*')) {
                unset($companyPackages[$packageName]);
            }
        }
        foreach($companyPackages as $packageName => $package) {
            $name = explode('/', $packageName)[1];
            $url = 'git@github.com:' . $this->vendorName . '/'. $this->vendorName . '.' . $name . '.git';
            $repository->addRepository($repository->createRepository('vcs', ['url' => $url], $packageName)); 
        }
    }
786628
public function onPostPackageInstall(PackageEvent $event)
    {
        $op = $event->getOperation();
        if ($op instanceof InstallOperation) {
            $package = $op->getPackage()->getName();
            if ($package === self::PACKAGE_NAME) {
                $this->logger->info('composer-merge-plugin installed');
                $this->state->setFirstInstall(true);
                $this->state->setLocked(
                    $event->getComposer()->getLocker()->isLocked()
                );
            }
        }
    }
1270926
protected function fireEvent($event)
    {
        $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]);
    }
491009
public static function publish(Event $event)
    {
        $publisher = new static();
        $config = $publisher->getConfig($event);
        $assetPackage = $publisher->getAssetPackage($config);
        $composerPackage = $publisher->getComposerPackage($event);
        (new Processor(new Filesystem(), $event->getIO()))->publish(
            $event->getComposer()->getInstallationManager()->getInstallPath($composerPackage),
            $publisher->getPublishingMap($assetPackage, $config),
            $config->isSymlink(),
            $config->isRelative()
        );
    }
1139937
public static function postPackageInstall(Event $event)
    {
        $config = $event->getComposer()->getConfig();
        $binDir = $config->get("bin-dir");
        self::initScript($binDir);

    }
192185
public static function Go(Event $event)
    {
        $event->getIO()->writeError('<info>Updating .gitignore: </info>', false);

        $composer = $event->getComposer();
        $repositoryManager = $composer->getRepositoryManager();
        $installManager = $composer->getInstallationManager();
        $extraConfiguration = $composer->getPackage()->getExtra();

        // Check in composer extra configuration if devOnly option is set
        $devRequires = (array_key_exists('autogitignore', $extraConfiguration)
            && $extraConfiguration['autogitignore'] == 'devOnly');

        // If devOnly option is set
        if ($devRequires) {
            // Grab original list of all require-dev packages
            $devRequires = array_keys($composer->getPackage()->getDevRequires());
            // Grab original list of all require packages
            $requires = array_keys($composer->getPackage()->getRequires());

            // Grab recursively require and require-dev packages
            foreach ($repositoryManager->getLocalRepository()->getPackages() as $package) {
                $devRequires = array_merge($devRequires, array_keys($package->getDevRequires()));
                $requires = array_merge($requires, array_keys($package->getRequires()));
            }

            // Remove duplicates
            $devRequires = array_unique($devRequires);
            $requires = array_unique($requires);

            // Sort packages
            sort($devRequires);
            sort($requires);
        }

        $packages = array();
        foreach ($repositoryManager->getLocalRepository()->getPackages() as $package) {
            // Test if we need to ignore the package
            // If the option devOnly is set, we check that
            // the package is not in the list of require-dev
            // OR is set in the list of require packages
            // before skipping.
            if ($devRequires && (!in_array($package->getName(), $devRequires) || in_array($package->getName(), $requires))) {
                continue;
            }
            $path = $installManager->getInstallPath($package);
            $packages[] = '/' . preg_replace('~^' . preg_quote(str_replace('\\', '/', getcwd()) . '/') . '~', '', str_replace('\\', '/', realpath($path))) . '/';
        }

        $packages = array_unique($packages);
        sort($packages);

        try {
            $gitIgnoreFile = GitIgnoreFile::create(getcwd() . DIRECTORY_SEPARATOR . '.gitignore');
            $gitIgnoreFile->setLines($packages);
            $gitIgnoreFile->save();
        } catch (Exception $exception) {
            $event->getIO()->writeError('<info>Failed - ' . $exception->getMessage() . '</info>');

            return false;
        }

        $event->getIO()->writeError('<info>Done - ' . count($packages) . ' packages ignored.</info>');

        return true;
    }
29850
public function preAutoloadDump(Event $event) {
    $root = $this->getBuildRoot();
    $autoload = $this->package->getDevAutoload();
    $autoload['psr-0']["Drupal\\Tests"] = $root . "/core/tests";
    $autoload['psr-0']["Drupal\\KernelTests"] = $root . "/core/tests";
    $autoload['psr-0']["Drupal\\FunctionalTests"] = $root . "/core/tests";
    $autoload['psr-0']["Drupal\\FunctionalJavascriptTests"] = $root . "/core/tests";
    $autoload['psr-4']["Drupal\\simpletest\\"] = $root . "/core/modules/simpletest/src";
    $this->package->setDevAutoload($autoload);
  }
162953
public static function execute(Event $event) {
    $io = $event->getIO();

    // Search upwards for a composer.json which depends on Open Social.
    $io->write('Searching for root package...');

    $file = static::getRootPackage();

    $package = $file->read();

    // Add the Asset Packagist repository if it does not already exist.
    if (isset($package['repositories'])) {
      $repository_key = NULL;

      foreach ($package['repositories'] as $key => $repository) {
        if ($repository['type'] == 'composer' && strpos($repository['url'], 'https://asset-packagist.org') === 0) {
          $repository_key = $key;
          break;
        }
      }

      if (is_null($repository_key)) {
        $package['repositories'][] = [
          'type' => 'composer',
          'url' => 'https://asset-packagist.org',
        ];
      }
    }

    // oomphinc/composer-installers-extender is required by Open Social and
    // depends on composer/installers, so it does not need to be specifically
    // included.
    unset(
      $package['require']['oomphinc/composer-installers-extender']
    );

    // Check if we need to add the bower and npm assets to the installer types.
    if (!isset($package['extra']['installer-types']) || !in_array('bower-asset', $package['extra']['installer-types'])) {
      $package['extra']['installer-types'][] = 'bower-asset';
    }
    if (!in_array('npm-asset', $package['extra']['installer-types'])) {
      $package['extra']['installer-types'][] = 'npm-asset';
    }

    // Get root folder based on the location of Drupal core. If we do it in this
    // way we can also support projects that have
    //    $package['extra']['installer-paths']['']
    $root_path = 'html/';
    foreach ($package['extra']['installer-paths'] as $path => $install_type) {
      if (in_array('drupal/core', $install_type, TRUE)) {
        // If Drupal core is installed in the root path we also want the
        // libraries there.
        if ($path == 'core') {
          $root_path = '';
        }
        else {
          $parts = explode('/core', $path);
          if (!empty($parts)) {
            $root_path = $parts[0] . '/';
          }
        }

        break;
      }
    }

    // Add the different library types to the installer paths.
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:drupal-library';
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:bower-asset';
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:npm-asset';

    $file->write($package);
    $io->write('Successfully updated your root composer.json file.');
  }