In Laravel 5.1 I'm trying to setup an environment specific configuration. In local and dev environment, my application(s) structure is similar to the typical subversion branches. So I have multiple installations of laravel in parallel. Example:
http://dev.domain/trunk/public/...
http://dev.domain/branches/branch1/public/...
To work with all this diffent versions of my applications I somehow need a dynamic configuration, related to the "base path", so the part between the domain and the public folder.
What I did so far, is to put the domain name in my app.php
. What I'm struggling with, is how or where to setup, this dynamic part depend on under which subpath you're calling your application.
What I tried is to setup a config file config/myapp/app.php
. That would be my production configuration, so the config parameter in there looks like this (Because in production I would have this subdirectories):
url_path_to_public = ''
Now I'd like to cascade this down to my local and dev environment by created a subfolder, named with my current environment dev
and than overwrite this parameter with a dynamic expression. So this looks like:
'url_base_path_to_public' => strstr(str_replace($_SERVER['DOCUMENT_ROOT'], '', __FILE__), '/config/dev/myapp/app.php', true).'/public',
So this file is located in:
config/dev/myapp/app.php
For some reason, this parameter is not being used, even though I' running my application in dev
mode. I expected the configuration to cascade that parameter.
The alternative would be to set this information directly in the environment-specific configuration-file .env
, but there I cannot use a dynamic expression like that mentioned above.
Did I make any mistake with cascation to work like expected?