Skip to content

Instantly share code, notes, and snippets.

@ilya-dev
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilya-dev/9578468 to your computer and use it in GitHub Desktop.
Save ilya-dev/9578468 to your computer and use it in GitHub Desktop.
[Laravel specific] Works perfectly if you need to execute an Artisan command AND get the output as a string.
<?php
if ( ! \function_exists('artisan_call'))
{
function artisan_call($command, array $parameters = array())
{
$buffer = new \Symfony\Component\Console\Output\BufferedOutput();
\Artisan::call($command, $parameters, $buffer);
return $buffer->fetch();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment