Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

c0ntax's avatar

Output from Artisan::call() in Laravel 5

In L4, you could do something like this to call an Artisan command from within your code and have its output sent to stdout:

$stream = fopen('php://stdout', 'w');
$output = new \Symfony\Component\Console\Output\StreamOutput($stream);
Artisan::call('the:command', $args, $output);

This doesn't work in L5. It seems that the 'call' method's signature has changed from this:

public function call($command, array $parameters = array(), OutputInterface $output = null)

to this:

public function call($command, array $parameters = [])

Which is a ~~massive~~ bit of a shame. Anyone know of a way to get at the output of called Artisan commands now? Is this a feature that's been removed or am I missing a sneaky way to do it?

0 likes
0 replies

Please or to participate in this conversation.