Laravel says the Application class is not found when you run artisan or open the site
Class "Illuminate\Foundation\Application" not foundShort answer
Laravel's core class lives in vendor/laravel/framework, so this error means Composer's autoloader does not know the framework. Either the vendor folder was never installed on this machine, or the autoloader was generated for different files. Run composer install, then composer dump-autoload.
Fix it fast
1Find out which cause you have
Check whether the framework is on disk at all.
ls vendor/laravel/framework/src/Illuminate/Foundation/Application.php2Match what you see, then jump to its fix
- 1
ls says 'No such file or directory' for the framework filevendor/ was never installed on this machineFix - 2
The framework file exists, but the class is still not found, often after copying vendor from another machine or after a partial updateThe generated autoloader is out of date or sealed to an old classmapFix
- 1
What does the error look like?
Class "Illuminate\Foundation\Application" not foundFatal error: Class 'Illuminate\Foundation\Application' not found in bootstrap/app.phpFatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found
Cause 1 of 2
vendor/ was never installed on this machine
1Check
Composer's docs advise adding vendor to .gitignore, so a fresh clone or an upload of the code without that folder has no framework. Only composer.json and composer.lock are committed.
ls vendor | head
git check-ignore vendor2Fix
Run install in the project root. It brings vendor/ in line with composer.lock. On a production server add the usual flags.
composer install
# production:
composer install --no-dev --optimize-autoloader3Verify
The file exists and artisan starts.
ls vendor/laravel/framework/src/Illuminate/Foundation/Application.php
php artisan --versionConfirmed by getcomposer.org
Cause 2 of 2
The generated autoloader is out of date or sealed to an old classmap
1Check
The autoloader files in vendor/composer are generated. With --classmap-authoritative, classes load only from the classmap, so anything missing from it is reported as not found.
grep -c "Illuminate\\\\Foundation\\\\Application" vendor/composer/autoload_classmap.php2Fix
Regenerate the autoloader.
composer dump-autoload3Verify
Start artisan again.
php artisan --versionConfirmed by getcomposer.org
How do I stop it coming back?
- Make composer install a fixed step of every deploy and of every fresh clone.
- Never copy vendor between machines with different PHP versions; install on the target.
- Keep vendor in .gitignore, as Composer advises, and commit composer.lock.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
require(vendor/autoload.php): Failed to open stream: No such file or directory
Fatal error: Uncaught Error: Failed opening required 'vendor/autoload.php'
PHP looked for vendor/autoload.php at a path where it does not exist.
3 causes, each with a fixBack end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fix