public static function isProgramInstalled($program) { if (self::isWindows()) { return WindowsSystem::isProgramInstalled($program); } $out = null; $return = null; @exec('which ' . $program, $out, $return); return $return === 0; }
/** * @return void * * @throws \Exception */ public function execute() { if (OperatingSystem::isProgramInstalled('composer.phar')) { $composerBin = 'composer.phar'; } elseif (OperatingSystem::isProgramInstalled('composer')) { $composerBin = 'composer'; } elseif (OperatingSystem::isProgramInstalled('composer.bat')) { $composerBin = 'composer'; } if (empty($composerBin)) { $composerBin = $this->downloadComposer(); } if (empty($composerBin)) { throw new \Exception('Cannot find or install composer. Please try it manually. https://getcomposer.org/'); } $this->output->writeln('<info>Found executable <comment>' . $composerBin . '</comment></info>'); $this->config['composer_bin'] = $composerBin; }