I have a Laravel application with a few dependencies, but it is enough to require almost 200MB on disk. I suppose this is the price for convenient dependencies installation and upgrade...

This application has to be hosted in multiple instances, but it seems not a viable solution to duplicate everything for all of them. So, I've managed to convince a single instance to act in different ways accordly to the web domain from it is reached.

In bootstrap/app.php, just below $app initialization, I've added

if (true) { // this is just to enable and disable the multi-instance setup easily, in different deployments  
    $instance = substr($_SERVER['SERVER_NAME'], 0, strpos($_SERVER['SERVER_NAME'], '.'));
    $env =  ('.env.' . $instance);

That's it. The application will load, or .env.baz when accessed from, or, finding different configurations about the backend database and similar local options.

I've also introduced a custom version of storage_path() function so to obtain different paths for different instances, in storage/foo, storage/bar and storage/baz.

I've still to figure out how to handle php artisan commands (above all: the migrate command), but I guess a good shell script iterating all the different .env.* will do the job.