Reputation: 2182
In Laravel's artisan can be used to execute many tasks including migrations, generation of resources...etc.
In Laravel 4, how could you run an artisan command from you app without using shell_exec
?
Upvotes: 1
Views: 3185
Reputation: 73
This is how you can get command output:
<?php
use Symfony\Component\Console\Output\StreamOutput;
class MyClass
{
public function myFunc()
{
$stream = fopen("php://output", "w");
Artisan::call('my-command', array(), new StreamOutput($stream));
var_dump($stream);
}
}
Upvotes: 1
Reputation: 1695
You run Artisan commands via Artisan::call
, for example:
Artisan::call('migrate')
Upvotes: 8