protected function execute(InputInterface $input, OutputInterface $output) { // This is a contrived example to show accessing services // from the container without needing the command itself // to extend from anything but Symfony Console's base Command. $app = $this->getApplication()->getService('console'); $output->writeln('Name: ' . $app->getName()); $output->writeln('Version: ' . $app->getVersion()); }