I'm trying to change the default vendor directory path configuration in my Laravel 8 project, but I'm stumbling in some problem.
So for, this is what I did:
File composer.json
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"vendor-dir": "php_modules/vendor"
},
File public/index.php
require __DIR__.'/../php_modules/vendor/autoload.php';
Terminal (re-generate autoload files):
composer dump-autoload
When I serve the page (terminal: php artisan serve), I get this error message:
Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in K:\syncsystem\tecnologias\php\laravel\aula\laravel8\syncsystem-laravel8-v1\bootstrap\app.php:14 Stack trace: #0 K:\syncsystem\tecnologias\php\laravel\aula\laravel8\syncsystem-laravel8-v1\public\index.php(48): require_once() #1 K:\syncsystem\tecnologias\php\laravel\aula\laravel8\syncsystem-laravel8-v1\server.php(21): require_once('...') #2 {main} thrown in K:\syncsystem\tecnologias\php\laravel\aula\laravel8\syncsystem-laravel8-v1\bootstrap\app.php on line 14
Is there somewhere else I should change in order for it to work properly?
I tried to find information about changing this path in the web, but all suggestions were incomplete.
Try changing the path to the vendor folder in /artisan php file.
From:
require __DIR__.'/vendor/autoload.php';
To:
require __DIR__.'/../php_modules/vendor/autoload.php';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.