public static function extensionResolver(Event $event) { $helper = new Helper\ExtensionDependancyHelper(); if ($helper->hasExplicitDependanciesOnExtensions() !== false) { // Skip this intensive, slow check if we already have explicit dependancies on PHP extensions return; } $event->getIO()->write('-----> Scanning and declaring implicit dependencies on PHP extensions...'); $exts = $helper->checkExtensions(); if (count($exts) > 0) { $event->getIO()->write(' WARNING: Implicit dependancies found on the following PHP extensions:'); foreach ($exts as $ext) { $event->getIO()->write(' - ' . $ext); } $event->getIO()->write(' You should run "composer require ext-<extension-name> \'*\'" locally and commit the result.'); } else { $event->getIO()->write(' No implicit dependancies found. You can speed up the deployment of this app and improve Symfony\'s performance by running "composer require ext-mbstring \'*\'" locally and committing the result.'); } }
private function scanDependancies(OutputInterface $output) { $helper = new ExtensionDependancyHelper(); $exts = $helper->checkExtensions(); if (count($exts) > 0) { $output->writeln('<error>Found implicit dependancies on PHP extensions.</error> Fixing... '); foreach ($exts as $ext) { $output->write(' > Declaring dependancy on the <comment>' . $ext . '</comment> extension'); $this->requireExtension($ext); } $this->changesMade = true; } else { if (extension_loaded('mbstring')) { $output->writeln('The mbstring extension is loaded locally, but not explicitly used or required by your application. Symfony performance can be improved with the mbstring extension, so it will be added as an explicit dependancy such that it is loaded on Heroku.'); try { $this->requireExtension('mbstring'); } catch (\RuntimeException $ex) { $output->writeln('<comment>Failed to declare dependancy on mbstring. Your application should run fine without it, so you can ignore this.</comment>'); $output->writeln('Caused by: ' . $ex->getMessage()); } $this->changesMade = true; } } }