Skip to content

Send output to Laravel's Artisan command or Symfony's Console command

Compare
Choose a tag to compare
@TitasGailius TitasGailius released this 27 Apr 21:36
· 23 commits to master since this release
a65f3b9

Output via Laravel Artisan Command

If you run Terminal from the Laravel's Artisan command, you may send the output to the console by
passing an instance of the Command to the output method:

public function handle()
{
    Terminal::output($this)->run('echo Hello, World');
}

Output via Symfony Console Command

If you run Terminal from the Symfony's Console command, you may send the output to the console by
passing an instance of the OutputInterface to the output method:

protected function execute(InputInterface $input, OutputInterface $output)
{
    Terminal::output($output)->run('echo Hello, World');
}