1use Symfony\Bundle\FrameworkBundle\Console\Application;
2use Symfony\Component\HttpKernel\KernelInterface;
3// *****
4 $application = new Application($kernel);
5 $application->setAutoExit(false);
6 $input = new ArrayInput([
7 'command' => 'swiftmailer:spool:send',
8 // (optional) define the value of command arguments
9 'fooArgument' => 'barValue',
10 // (optional) pass options to the command
11 '--message-limit' => $messages,
12 ]);
13 // You can use NullOutput() if you don't need the output
14 $output = new BufferedOutput();
15 $application->run($input, $output);
16 // return the output, don't use if you used NullOutput()
17 $content = $output->fetch();