I\'m working on 2 applications right now. The first one is a CMS, and the second is a shop. I want to move my vendor one level above and the share it between projects.
For Laravel 5, 6 and 7+
After adding the new vendor folder config:
...
"config": {
...,
"vendor-dir": "../vendor"
},
...
Then run composer update
Then you need to change two files:
For your app: public/index.php
require __DIR__.'/../../vendor/autoload.php';
Your artisan command in the root folder: artisan
require __DIR__.'/../vendor/autoload.php';
Package auto-discovery in Illuminate\Foundation\PackageManifest:
$this->vendorPath = $basePath.'/../vendor'; //Change this line in constructor
and rerun
php artisan package:discover --ansi