Zend Project architecture

134 views Asked by At

I'm currently using Zend 3 for a project (or a range of projects). In order to avoid multiple vendor folders per project, I'd like to have ONE vendor folder at root level that every project runs from.

In my application /public/index.php file, I have changed this line:

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

to this:

include __DIR__ . '/../../shared/vendor/autoload.php';

When I did this, I saw this error:

Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException with message Module (Application) could not be initialized. in C:\Users\b28934\Documents\server\UwAmp\www\zf3\app\vendor\zendframework\zend-modulemanager\src\ModuleManager.php on line 203"

Any suggestions? Is there something I'm missing in my composer.json file?

1

There are 1 answers

2
Pᴇʜ On
  1. First of all there is no need of having only one vendor folder for all projects. Drive space is cheap nowadays. I see definitely no reason.
  2. It is by design, that every composer project has its own vendor folder, because it would fail if you had 2 projects which require the same package but in different versions.

I suggest keep it simple. Keep it like it is designed by smart people. And don't try to mess it up for no reason.