composer->setAutoExit(false); } /** * @param string|string[] $packages * @throws Exception */ public function require( string|array $packages, ?OutputInterface $output = null ): int { $input = new ArrayInput([ 'command' => 'require', 'packages' => is_string($packages) ? [$packages] : $packages, '--with-all-dependencies' => null ]); return $this->run($input, $output); } /** * @param string|string[] $packages * @throws Exception */ public function reinstall( string|array $packages, ?OutputInterface $output = null ): int { $input = new ArrayInput([ 'command' => 'reinstall', 'packages' => is_string($packages) ? [$packages] : $packages ]); return $this->run($input, $output); } /** * @param string|string[] $packages * @throws Exception */ public function remove( string|array $packages, ?OutputInterface $output = null ): int { $input = new ArrayInput([ 'command' => 'remove', 'packages' => is_string($packages) ? [$packages] : $packages ]); return $this->run($input, $output); } /** * @param string|string[] $packages * @throws Exception */ private function run( InputInterface $input, ?OutputInterface $output = null ): int { $code = $this->composer->run($input, $output); return $code; } }