Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lumen class Artisan not found

Tags:

php

lumen

I am working on an Lumen project.

I try to use

Artisan::call('my-command')

But PHP says me the class Artisan is not defined.

I have already enable Facade with the following command :

$app->withFacades();

So the Log class works after use Log; line. I have already add the use Artisan line. But it doesn't works.

The following command works in CLI:

php artisan my-command

Do you have any idea ?

like image 898
Samuel Dauzon Avatar asked Mar 13 '23 18:03

Samuel Dauzon


1 Answers

This error occured because I use a wrong use sentence :

use Artisan; // Doesn't work

I must use this absolute use sentence :

use Illuminate\Support\Facades\Artisan;

I hope it will be helpful

like image 107
Samuel Dauzon Avatar answered Mar 23 '23 17:03

Samuel Dauzon