create($_SERVER); $cli = $magentoObjectManager->create(\Magento\Framework\Console\Cli::class); $input = new StringInput($command); $input->setInteractive(false); $output = new NullOutput(); $cli->doRun($input, $output); } else { throw new \InvalidArgumentException("Command GET parameter is not set."); }