use Zenstruck\Console\CommandRunner;
class AppController extends AbstractController
{
#[Route(path: '/run-command', name: 'app_run_command')]
public function runCommand(MyCommand $command): Response
{
CommandRunner::for($command, 'Bob p@ssw0rd --role ROLE_ADMIN')->run(); // works great
CommandRunner::for($command, '--help')->run(); // fails, says --help isn't defined
}
}
Using the MyCommand example in the documentation