protected function execute(InputInterface $input, OutputInterface $output) { $filename = $input->getOption('file'); $config = $this->getConfig($input); list($name, $port) = explode(':', $input->getArgument('name') . ':80'); $listenIPv4 = new Directive('listen', [new Param($port)]); $listenIPv6 = new Directive('listen', [new Param("[::]:{$port}"), new Param('default'), new Param('ipv6only=on')]); // TODO: Find server by name $server = new Server([$listenIPv4, $listenIPv6]); if ($name != 'localhost' && !empty($name)) { $server->append(new Directive('server_name', [new Param($name)])); } $config->append($server); $builder = new Builder(); $builder->append($server); $builder->dumpFile($filename); }