One common provider with two projects

I am currently working on two applications. The first is the CMS, and the second is the store. I want to move my provider one level higher and share it between projects.

So my structure would be something like this:

project1/
project2/
shared_vendor/

I read about it. I changed the bootloader variable app/autoload.php:

$loader = require __DIR__.'/../vendor/autoload.php';

at

$loader = require __DIR__.'/../../vendor/autoload.php';

And I also changed vendor-dirmine composer.jsonto:

    "config": {
      "bin-dir": "bin",
      "vendor-dir": "vendor"
    },

at

    "config": {
      "bin-dir": "bin",
      "vendor-dir": "/../vendor"
    },

And after that I get this error:

ClassNotFoundException in AppKernel.php line 20: Attempted to load 
class "CmsUserBundle" from namespace "Cms\UserBundle".
Did you forget a "use" statement for another namespace?

What am I doing wrong? I forgot to change something? Thanks in advance.

+5
source share
2 answers

The composer works on the basis of each project.

One project - one supplier folder. No, two projects and one "shared" provider folder.

"" PEAR , . , .

...

"shared vendor folder", - "" "" , . composer.json (!) . , .

(cms shop) "" . , :

|-container-project
  +-CMS
    |-src
    +-tests
  +-Shop
    |-src
    +-tests
  +-vendors      // contains dependencies for both projects (CMS + Shop)
|-composer.json  // define requirements for both projects

composer.json . composer.json composer.json .

, .

+5

, , / , , , , .

:

cd /var/www/SiteA
composer install
# git clone new project into /var/www/SiteB
cd ../SiteB
# If vendor directory is already there, delete it: rm -rf vendor
# create symlink to Site A vendor directory
ln -s /var/www/SiteA/vendor

, , , , , .

0

All Articles