Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting the "Class 'Artisan' not found" error?

Tags:

php

laravel

I am currently using artisan with laravel and I get the following error if I try to run any command with artisan (such as php artisan optimize):

[Symfony\Component\Debug\Exception\FatalErrorException] Class 'Artisan' not found

I haven't seen this error anywhere on the internet and frankly am confused that it has showed up. I haven't altered any of the the core code and I have tried composer dump-autoload with no success. Any ideas would be appreciated.

like image 861
Shawn31313 Avatar asked Oct 15 '25 14:10

Shawn31313


1 Answers

Inside config/app.php ensure you have an alias set up like so:

return [
    'aliases' => [
        // ...

        'Artisan' => Illuminate\Support\Facades\Artisan::class,

        // ...
    ]
];
like image 150
Harry Avatar answered Oct 18 '25 09:10

Harry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!