So, I am having quiet a big SAAS web application build on top of Symfony 3. What started off with about 10 - 20 applications, has now grown to over 500+ applications. The vendor directory alone already per application is 150+ MB in size.
All those applications have their own database. I would like to keep it this way. However, I believe it would be nice if some code is being shared. Take the vendor and src directory for example. It's the same across every application, but yet all of them are "loaded" individually in OpCache. I believe that in sense of resources, it would be best if these directories would be shared.
Both Composer and Symfony don't really seem to support multi-instance applications with shared directories that much. I was wondering however if someone had any clues to achieve what I had in mind or that my plan is just not feasible?
The configuration is different per application (parameters.yml) and the web directory contains different stylesheets per application. So they need to be separated from the rest.
I've been thinking of using the environment setting for this, but it doesn't feel right that we have environment "test", "dev", "application1", "application2", etc. config_prod.yml suddenly also becomes unusable then.
Is my way of thinking wrong? Any suggestions on how to achieve this? Or should I just go with a complete separate instances?
(Our application is using SemVer and it would even be nice if we have shared code for version 1.0.0., version 1.1.0 etc. So that's even a next layer on top. But perhaps that is the next step.)
edit: To clarify a bit more; In essence you could say that the web directory and var directory are both none-sharable. The web directory contains custom stylesheets and is the main entry point. The var directory contains cache files, which are different per application depending on their database settings. Finally you also have the custom parameter file, which is different per application to store the database credentials.
I tried symlinking, but composer is not really happy with that. Also, when using symlinks, the working directory is always the real used directory, not the actual directory you are symlinked from. I also tried with custom settings in the vhost file of the application. Overriding the cache and kernel directories are possible, but again you loose the actual directory you are symlinking from.