One shared vendor with two projects

后端 未结 4 1576
梦毁少年i
梦毁少年i 2020-12-20 19:24

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.

4条回答
  •  半阙折子戏
    2020-12-20 19:45

    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:

    1. For your app: public/index.php

      require __DIR__.'/../../vendor/autoload.php';

    2. Your artisan command in the root folder: artisan

      require __DIR__.'/../vendor/autoload.php';

    3. Package auto-discovery in Illuminate\Foundation\PackageManifest:

      $this->vendorPath = $basePath.'/../vendor'; //Change this line in constructor

    and rerun

    php artisan package:discover --ansi
    

提交回复
热议问题