phplaraveldirectory-structurelaravel-5.3multiple-projects

How can I have one Laravel PHP install with multiple projects?


I noticed that Laravel 5.3 takes about 41MB on average of disk space per project.

Is there a tidy way to configure things so that Laravel is installed once on my PHP server (which is dedicated to Laravel-only stuff) and then have multiple projects (some as separate domains, some as subdirs) use that same Laravel instance?

So for instance, I could have /usr/share/laravel and put everything in there, but then in /var/www, I could put each of my domains (/var/www/test1.com, /var/www/test2.com) and subfolders on domains (/var/www/test1.com/project2) and then they would all utilize the same /usr/share/laravel.


Solution

  • You could use symlinks, I've never tried this but I guess it would involve creating separate directories for each application then creating symlinks to a shared vendor directory (which includes Laravel).

    This would allow you to separately version control all the application specific files but share the dependencies. Watch out though, if your composer.json files have differing versions listed you might run into trouble.