/** * Returns composer instance. * * @param bool $packagist * @return null */ protected function getComposer($packagist = false) { $config = $this->blueprint; $config['config'] = ['vendor-dir' => $this->paths['path.packages'], 'cache-files-ttl' => 0]; $config['require'] = $this->packages; if (!$packagist) { $config['repositories'][] = ['packagist' => false]; } // set memory limit, if < 512M $memory = trim(ini_get('memory_limit')); if ($memory != -1 && $this->memoryInBytes($memory) < 512 * 1024 * 1024) { @ini_set('memory_limit', '512M'); } Factory::bootstrap(['home' => $this->paths['path.temp'] . '/composer', 'cache-dir' => $this->paths['path.temp'] . '/composer/cache']); $composer = Factory::create($this->getIO(), $config); $composer->setLocker(new Locker($this->getIO(), new JsonFile(preg_replace('/\\.php$/i', '.lock', $this->file)), $composer->getRepositoryManager(), $composer->getInstallationManager(), json_encode($config))); return $composer; }