Configuration
Environment
myMVC needs to know which config files to load; therefore you will need to tell myMVC what Environment currently should be set as active. And this is done my setting the ENV variable MVC_ENV
.
public/.env
in the public/
folder you will find a .env
file.
There the MVC_ENV variable is declared.
# Environment
MVC_ENV=develop
Main config
/config/
Any file in this directory which has suffix .php will be required automatically (Attention: Reading A-Z). This is the right place to extend or overwrite the main config globally (for all modules), to place global policies and so on.
myMVC main config file
/config/_myMVC.php
- you should not edit this file
- if you want to change settings, override values in your own module config file
Module config file
syntax
modules/{moduleName}/etc/config/{moduleName}/config/{stage}.php
example: module=Foo
, MVC_ENV=develop
modules/Foo/etc/config/Foo/config/develop.php
if you have set MVC_ENV
to 'develop'
, the folder modules/Foo/etc/config/Foo/config/develop.php
would then be created automatically at runtime if it does not exist.
Access MVC_*
config values
you can access MVC configurations via Config
Class.
For each Variable there is an identical getter.
syntax
Config::get_{MVC_VARIABLE}()
example
Config::get_MVC_BASE_PATH()
Alternativley you can access all MVC Configs via Registry.
alternative
Registry::get('MVC_BASE_PATH');