argument('domain'); $domainFlags = ''; foreach($domains as $domain) { $domainFlags .= '-d '.$domain.' '; } exec('certbot --non-interactive --agree-tos -m '.$this->argument('email').' --nginx '.$domainFlags, $output); $this->line(implode("\n", $output)); foreach($output as $line) { //Congratulations! //check for string } } }