ahmed
ahmed

Reputation: 14666

In Laravel 4 how to call Artisan command through web interface?

In Laravel 4 how to call Artisan commands through web interface?

I have tried the following

$command = "controller:make";
$parameters = array('name' => 'FooController');
Artisan::call($command,$parameters);

however I am getting this error message

 InvalidArgumentException: There are no commands defined in the "controller" namespace.

any idea?

Upvotes: 4

Views: 6935

Answers (3)

Laurence
Laurence

Reputation: 60048

Artisan is not designed to be called via the web.

However, if you need to, you can use this bundle which will allow you to expose Artisan to the web.

Make sure you read the bit about not using it in production, or adding some sort of password protect option!

Upvotes: 0

Nick
Nick

Reputation: 99

Did you register your command? I have no problems at all calling a artisan command through the web using Arisan:call(). I did not install a bundle for it.

Upvotes: 2

msurguy
msurguy

Reputation: 524

There's now a bundle that does exactly this called WebArtisan, please see this page for more:

http://forums.laravel.io/viewtopic.php?id=10334

If you find this helpful please mark my answer.

Upvotes: 3

Related Questions