I'm using Artisan::call()
in one of my routes and would like to save the command output to a variable.
Is there any way to capture the STDOUT and STDERR generated by the artisan command?
This is a way:
use Symfony\Component\Console\Output\BufferedOutput;
Route::get('/test', function()
{
$output = new BufferedOutput;
Artisan::call('list', array(), $output);
return $output->fetch();
});