Configuration
- Environment
/.env
- Config files, -places and reading order
- Module's composer.json
- Access module config values
- Access
MVC_*
config values - Appendix
Environment /.env
In the root folder of your Emvicy copy you will find an .env
file.
#-----------------------------------------------------
# My Application
# Environment
MVC_ENV=develop
#-----------------------------------------------------
# DB
db.type=mysql
db.host=127.0.0.1
db.port=3306
db.dbname=Emvicy1x
db.username=root
db.password=
MVC_ENV
There the variable MVC_ENV
declares what Environment is valid for Emvicy. You can name the value as you like - But common values are: develop
, test
, production
or live
.
Database Settings
If you want to use a Database, edit the settings for your Database in the /.env
file as well.
See also Chapter Database
Custom .env variables
You are free to set up any key=value
declarations you want in that /.env
file.
Any key=value
pair found in the file will be set by putenv()
at start and you can access those variables via php's getenv()
command.
Example
# custom
foo=bar
Check
// string(3) "bar"
var_dump(
getenv('foo')
);
Config files, -places and reading order
The following locations for configurations exist and are read in succession in the appropriate order.
This also means that a later loaded configuration beats (overrides) an earlier loaded one.
- ⬆ Emvicy config folder
/config/
- Any
*.php
file in this directory will be included; Reading order isa-z
- Coverage: globally - Configs placed here are valid to all modules and to all environments
- By default, the following files are located here
_mvc.php
: This file contains basic settings that are necessary for operation. You should not edit this file. If you want to change settings, override values in your own module config. Emvicy config variable names always begin withMVC_
.- See content of file
/config/_mvc.php
- ⬆ Module's config folder (overrides 1.)
/modules/{moduleName}/etc/config/
- Any
*.php
file in this directory will be included; Reading order isa-z
- Coverage: module globally - Configs placed here are valid to all environments of your module
- By default, the following files are located here
_mvc.php
: further MVC configs. Emvicy config variable names always begin withMVC_
.- See Example
/modules/Foo/etc/config/_mvc.php
- ⬆ Module's environment config file (overrides 2.)
- Schema:
/modules/{moduleName}/etc/config/{moduleName}/config/{environment}.php
- If your module is named
Foo
and you have setMVC_ENV
to'develop'
, your environment config file has to bemodules/Foo/etc/config/Foo/config/develop.php
. Make sure it exists.
- If your module is named
- Coverage: module environment specific - The concrete environment config file is loaded appropiate to your environment of your module you have set in
MVC_ENV
- See Example
/modules/Foo/etc/config/Foo/config/develop.php
- Schema:
⚠ If you create a module by using emvicy (see: Creating a primary Module), the corresponding "Module's environment config file" will be generated automatically.
But if you change the value of the MVC_ENV
variable of /.env
config file afterwards, make sure the corresponding "Module's environment config file" does exist in your module.
Example: If your Module is named Foo
, and you set MVC_ENV=production
, then the config file /modules/Foo/etc/config/Foo/config/production.php
has to exist.
Module's composer.json
Extend your module with third libraries using composer. You don't need to have composer installed locally, because Emvicy has a composer.phar on board which is used to install and update libraries.
Write your requirements into the composer.json file which you find here:
composer.json
/modules/{moduleName}/etc/config/{moduleName}/composer.json
The next time you run your Emvicy Application, Emvicy will automatically perform a composer install
.
Alternatively you can of course also perform an installation by hand.
Installed vendor folder
/modules/{moduleName}/etc/config/{moduleName}/vendor
Emvicy will automatically integrate all /vendor/autoload.php
autoloaders from any Emvicy module.
keep vendor libraries updated
simply run emvicy:
php emvicy update
Access module config values
Access module configuration array via the \MVC\Config
Class.
Example
$aModule = \MVC\Config::MODULE();
Alternativley you can access the module configuration array via \MVC\Registry
.
Alternative
$aModule = \MVC\Registry::get('MODULE');
Access MVC_*
config values
Access MVC configurations via the \MVC\Config
Class. For each variable there is an identical getter and for many there are setters also.
Setter
\MVC\Config::set_{MVC_VARIABLE}( value );
Getter
// Getter
$mVar = \MVC\Config::get_{MVC_VARIABLE}();
Setter Example
\MVC\Config::set_MVC_LOG_SQL(false); # logging SQL Statements true|false
Getter Example
$bLogSql = \MVC\Config::get_MVC_LOG_SQL(); # logging SQL Statements true|false
Alternativley you can access all MVC Configs via \MVC\Registry
.
Alternative
$sMvcBasePath = \MVC\Registry::get('MVC_BASE_PATH');
List of Setters
Config::set_MVC_CACHE_DIR();
Config::set_MVC_EVENT();
Config::set_MVC_EVENT_ENABLE_WILDCARD();
Config::set_MVC_EVENT_LOG_RUN();
Config::set_MVC_INFOTOOL_ENABLE();
Config::set_MVC_LOG_AUTOLOADER();
Config::set_MVC_LOG_DETAIL();
Config::set_MVC_LOG_FILE_REQUEST();
Config::set_MVC_LOG_FILE_ROUTEINTERVALL();
Config::set_MVC_LOG_FILE_SQL();
Config::set_MVC_LOG_FORCE_LINEBREAK();
Config::set_MVC_LOG_REQUEST();
Config::set_MVC_LOG_SQL();
Config::set_MVC_MODULE_PRIMARY_VIEW();
Config::set_MVC_PHP_SERVER();
Config::set_MVC_POLICY();
Config::set_MVC_SESSION();
Config::set_MVC_SESSION_ENABLE();
Config::set_MVC_SESSION_NAMESPACE();
Config::set_MVC_UNIQUE_ID();
List of Getters
Config::get_MVC_APPLICATION_INIT_DIR();
Config::get_MVC_APPLICATION_PATH();
Config::get_MVC_BASE_PATH();
Config::get_MVC_BIN_FIND();
Config::get_MVC_BIN_GREP();
Config::get_MVC_BIN_MOVE();
Config::get_MVC_BIN_PHP_BINARY();
Config::get_MVC_BIN_PS();
Config::get_MVC_BIN_REMOVE();
Config::get_MVC_BIN_SED();
Config::get_MVC_BIN_XARGS();
Config::get_MVC_CACHE_CONFIG();
Config::get_MVC_CACHE_DIR();
Config::get_MVC_CLI();
Config::get_MVC_CONFIG_DIR();
Config::get_MVC_CORE();
Config::get_MVC_ENV();
Config::get_MVC_EVENT();
Config::get_MVC_EVENT_ENABLE_WILDCARD();
Config::get_MVC_EVENT_LOG_RUN();
Config::get_MVC_INFOTOOL_ENABLE();
Config::get_MVC_LIBRARY();
Config::get_MVC_LOG_AUTOLOADER();
Config::get_MVC_LOG_DETAIL();
Config::get_MVC_LOG_FILE_DEFAULT();
Config::get_MVC_LOG_FILE_DIR();
Config::get_MVC_LOG_FILE_ERROR();
Config::get_MVC_LOG_FILE_EVENT();
Config::get_MVC_LOG_FILE_NOTICE();
Config::get_MVC_LOG_FILE_POLICY();
Config::get_MVC_LOG_FILE_REQUEST();
Config::get_MVC_LOG_FILE_ROUTEINTERVALL();
Config::get_MVC_LOG_FILE_SQL();
Config::get_MVC_LOG_FILE_WARNING();
Config::get_MVC_LOG_FORCE_LINEBREAK();
Config::get_MVC_LOG_REQUEST();
Config::get_MVC_LOG_SQL();
Config::get_MVC_METHODNAME_PRECONSTRUCT();
Config::get_MVC_MODULES_DIR();
Config::get_MVC_MODULE_PRIMARY_COMPOSER_DIR();
Config::get_MVC_MODULE_PRIMARY_CONFIG_DIR();
Config::get_MVC_MODULE_PRIMARY_CONTROLLER_DIR();
Config::get_MVC_MODULE_PRIMARY_DATATYPE_DIR();
Config::get_MVC_MODULE_PRIMARY_DIR();
Config::get_MVC_MODULE_PRIMARY_ETC_DIR();
Config::get_MVC_MODULE_PRIMARY_EVENT_DIR();
Config::get_MVC_MODULE_PRIMARY_MODEL_DIR();
Config::get_MVC_MODULE_PRIMARY_NAME();
Config::get_MVC_MODULE_PRIMARY_POLICY_DIR();
Config::get_MVC_MODULE_PRIMARY_STAGING_CONFIG_DIR();
Config::get_MVC_MODULE_PRIMARY_VIEW();
Config::get_MVC_MODULE_PRIMARY_VIEW_DIR();
Config::get_MVC_PHP_SERVER();
Config::get_MVC_POLICY();
Config::get_MVC_PUBLIC_PATH();
Config::get_MVC_ROUTE_QUERY_PARAM_C();
Config::get_MVC_ROUTE_QUERY_PARAM_M();
Config::get_MVC_ROUTE_QUERY_PARAM_MODULE();
Config::get_MVC_ROUTING_FALLBACK();
Config::get_MVC_SECURE_REQUEST();
Config::get_MVC_SESSION();
Config::get_MVC_SESSION_ENABLE();
Config::get_MVC_SESSION_NAMESPACE();
Config::get_MVC_SESSION_OPTIONS();
Config::get_MVC_SESSION_PATH();
Config::get_MVC_SMARTY_CACHE_DIR();
Config::get_MVC_SMARTY_CACHE_STATUS();
Config::get_MVC_SMARTY_PLUGINS_DIR();
Config::get_MVC_SMARTY_TEMPLATE_CACHE_DIR();
Config::get_MVC_SMARTY_TEMPLATE_DEFAULT();
Config::get_MVC_SMARTY_TEMPLATE_DIR();
Config::get_MVC_SSL_PORT();
Config::get_MVC_UNIQUE_ID();
Config::get_MVC_VERSION();
Config::get_MVC_VIEW_TEMPLATE_DIR();
Config::get_MVC_WEB_ROOT();
Appendix
<?php
/**
* @package Emvicy
* @copyright ueffing.net
* @author Guido K.B.W. Üffing <emvicy@ueffing.net>
* @license GNU GENERAL PUBLIC LICENSE Version 3. See application/doc/COPYING
*
* these configs here can be extended and overwritten by:
* `/modules/{module}/etc/config/_mvc.php`
* `/modules/{module}/etc/config/{module}/config/{stage}.php`
*/
//-------------------------------------------------------------------------------------
// MVC
MVC_RUNTIME_SETTINGS: {
// show error messages
error_reporting(E_ALL);
// enable exit on "kill" command and CLI break (CTRL-C)
// This command needs the pcntl extension to run.
// exclude emvicy usage (e.g. if php's builtin webserver is running `php emvicy s`)
if (false === getenv('emvicy'))
{
(function_exists('pcntl_async_signals')) ? pcntl_async_signals(true) : false;
(function_exists('pcntl_signal')) ? pcntl_signal(SIGTERM, function(){exit();}) : false;
(function_exists('pcntl_signal')) ? pcntl_signal(SIGINT, function(){exit();}) : false;
}
/*
* @see http://www.php.net/manual/en/timezones.php
* @see http://stackoverflow.com/a/5559239/2487859
* to get array of available timezones see result of timezone_identifiers_list()
* try to get timezone (ubuntu), or set to UTC
*/
date_default_timezone_set(((file_exists('/etc/timezone')) ? trim(file_get_contents('/etc/timezone')) : 'UTC'));
setlocale(LC_ALL, 'C');
// show InfoTool bar
$aConfig['MVC_INFOTOOL_ENABLE'] = true;
// Log autoloader actions
$aConfig['MVC_LOG_AUTOLOADER'] = true;
// address the built-in php server will run on
$aConfig['MVC_PHP_SERVER'] = '127.0.0.1:1969';
}
MVC_BIN: {
$aConfig['MVC_BIN_PHP_BINARY'] = PHP_BINARY;
$aConfig['MVC_BIN_PS'] = whereis('ps'); # ps - report a snapshot of the current processes.
$aConfig['MVC_BIN_SED'] = whereis('sed'); # sed - stream editor for filtering and transforming text
$aConfig['MVC_BIN_MOVE'] = whereis('mv'); # mv - move (rename) files
$aConfig['MVC_BIN_GREP'] = whereis('grep'); # grep, egrep, fgrep, rgrep - print lines that match patterns
$aConfig['MVC_BIN_FIND'] = whereis('find'); # find - search for files in a directory hierarchy
$aConfig['MVC_BIN_REMOVE'] = whereis('rm'); # rm - remove files or directories
$aConfig['MVC_BIN_XARGS'] = whereis('xargs'); # xargs - build and execute command lines from standard input
}
MVC_APPLICATION_SETTINGS_I: {
/**
* keys for "query" notation in \MVC\Route routings
* e.g.: 'module=Foo&c=index&m=index'
*/
$aConfig['MVC_ROUTE_QUERY_PARAM_MODULE'] = 'module';
$aConfig['MVC_ROUTE_QUERY_PARAM_C'] = 'c';
$aConfig['MVC_ROUTE_QUERY_PARAM_M'] = 'm';
/**
* Name of method to be executed in the Target Controller Class
* before session and other main functionalities.
* It will be called in /application/library/MVC/Application.php:
* Controller::runTargetClassPreconstruct();
*
* This method is also declared via interface MVC_Interface_Controller.
* Due to this, you should not edit this name, otherwise you have to
* rename the method in that interface class, too.
*
* default:
* $aConfig['MVC_METHODNAME_PRECONSTRUCT'] = '__preconstruct';
*/
$aConfig['MVC_METHODNAME_PRECONSTRUCT'] = '__preconstruct';
/**
* Paths etc.
*/
$aConfig['MVC_WEB_ROOT'] = dirname($_SERVER['PHP_SELF']);
$aConfig['MVC_BASE_PATH'] = realpath(__DIR__ . '/../');
$aConfig['MVC_APPLICATION_PATH'] = $aConfig['MVC_BASE_PATH'] . '/application';
$aConfig['MVC_PUBLIC_PATH'] = $aConfig['MVC_BASE_PATH'] . '/public';
$aConfig['MVC_APPLICATION_INIT_DIR'] = $aConfig['MVC_APPLICATION_PATH'] . '/init';
$aConfig['MVC_LIBRARY'] = $aConfig['MVC_APPLICATION_PATH'] . '/library';
$aConfig['MVC_MODULES_DIR'] = $aConfig['MVC_BASE_PATH'] . '/modules';
// Main Emvicy config directory
$aConfig['MVC_CONFIG_DIR'] = $aConfig['MVC_BASE_PATH'] . '/config';
/**
* Event
*/
// allow declaring listeners with wildcard, e.g.: Event::bind('foo.bar.*', ... );
// matches to event 'foo.bar.baz': Event::run('foo.bar.baz');
// mandatory: asterisk `*` at the end
// notice: wildcard listeners are processed before the regular event listeners
$aConfig['MVC_EVENT_ENABLE_WILDCARD'] = true;
// logging of each simple "RUN" event into MVC_LOG_FILE_EVENT
// remember:
// - events marked as "RUN": fired events without any listener (nothing happens)
// - events marked as "RUN+": fired events with bonded listeners / closures to be executed
// be aware that setting this to "true" would produce much data in the logfile (consider using logrotate!)
// anyway this might be useful for a develop environment, as it helps debugging and understanding
$aConfig['MVC_EVENT_LOG_RUN'] = false;
/**
* Log
* consider a logrotate mechanism for these logfiles as they may grow quickly
*/
$aConfig['MVC_LOG_FILE_DIR'] = $aConfig['MVC_APPLICATION_PATH'] . '/log/'; # trailing slash required
$aConfig['MVC_LOG_FILE_DEFAULT'] = $aConfig['MVC_LOG_FILE_DIR'] . 'default.log';
$aConfig['MVC_LOG_FILE_ERROR'] = $aConfig['MVC_LOG_FILE_DIR'] . 'error.log';
$aConfig['MVC_LOG_FILE_WARNING'] = $aConfig['MVC_LOG_FILE_DIR'] . 'warning.log';
$aConfig['MVC_LOG_FILE_NOTICE'] = $aConfig['MVC_LOG_FILE_DIR'] . 'notice.log';
$aConfig['MVC_LOG_FILE_POLICY'] = $aConfig['MVC_LOG_FILE_DIR'] . 'policy.log';
$aConfig['MVC_LOG_FILE_EVENT'] = $aConfig['MVC_LOG_FILE_DIR'] . 'event.log';
$aConfig['MVC_LOG_FILE_REQUEST'] = $aConfig['MVC_LOG_FILE_DIR'] . 'request.log';
$aConfig['MVC_LOG_FILE_SQL'] = $aConfig['MVC_LOG_FILE_DIR'] . 'sql.log';
$aConfig['MVC_LOG_FILE_ROUTEINTERVALL'] = $aConfig['MVC_LOG_FILE_DIR'] . 'route_intervall.log';
// 1) make sure write access is given to the folder
// as long as the db user is going to write and not the webserver user
// 2) consider a logrotate mechanism for this logfile as it may grow quickly
$aConfig['MVC_LOG_FILE_DB_DIR'] = '/tmp/';
// control log details
$aConfig['MVC_LOG_DETAIL'] = [
'date' => true,
'host' => true,
'env' => true,
'ip' => true,
'uniqueid' => true,
'sessionid' => true,
'count' => true,
'debug' => true,
'message' => true,
];
// force linebreaks in logfiles no matter what
$aConfig['MVC_LOG_FORCE_LINEBREAK'] = false;
// logging request into request.log
$aConfig['MVC_LOG_REQUEST'] = false;
// logging of SQL Statements
$aConfig['MVC_LOG_SQL'] = false;
/**
* Database
*/
/**
* Caching
*/
// cache directory
$aConfig['MVC_CACHE_DIR'] = $aConfig['MVC_APPLICATION_PATH'] . '/cache';
$aConfig['MVC_CACHE_CONFIG'] = array(
'bCaching' => true,
'sCacheDir' => $aConfig['MVC_CACHE_DIR'],
'iDeleteAfterMinutes' => 1440,
'sBinRemove' => $aConfig['MVC_BIN_REMOVE'],
'sBinFind' => $aConfig['MVC_BIN_FIND'],
'sBinGrep' => $aConfig['MVC_BIN_GREP']
);
/**
* misc
*/
// Secure Port, SSL
$aConfig['MVC_SSL_PORT'] = 443;
// boolean Request is secure ? (SSL)
$aConfig['MVC_SECURE_REQUEST'] = (array_key_exists('HTTPS', $_SERVER) && strtolower($_SERVER['HTTPS']) !== 'off') || (array_key_exists('SERVER_PORT', $_SERVER) && ($_SERVER['SERVER_PORT'] == $aConfig['MVC_SSL_PORT']));
/**
* Session
*/
// session directory and
// Session options @see http://php.net/manual/de/session.configuration.php
$aConfig['MVC_SESSION_NAMESPACE'] = 'Emvicy';
$aConfig['MVC_SESSION_PATH'] = $aConfig['MVC_APPLICATION_PATH'] . '/session';
$aConfig['MVC_SESSION_OPTIONS'] = array(
'cookie_httponly' => true,
'auto_start' => 0,
'save_path' => $aConfig['MVC_SESSION_PATH'],
'cookie_secure' => $aConfig['MVC_SECURE_REQUEST'],
'name' => 'Emvicy' . (($aConfig['MVC_SECURE_REQUEST']) ? '_secure' : ''), // @see /public/.htaccess
'save_handler' => 'files',
'cookie_lifetime' => 0,
// max value for "session.gc_maxlifetime" is 65535. values bigger than this may cause php session stops working.
'gc_maxlifetime' => 65535,
'gc_probability' => 1,
'use_strict_mode' => 1,
'use_cookies' => 1,
'use_only_cookies' => 1,
'upload_progress.enabled' => 1,
);
// default behaviour
// false: session won't start. This means NO cookie is written to client
// true: session will start
$aConfig['MVC_SESSION_ENABLE'] = false;
// Routing Class
$aConfig['MVC_ROUTING_CLASS'] = '\\MVC\\Routing';
// routing.json file
$aConfig['MVC_ROUTING_JSON'] = '';
// detect if request is done via cli. set boole true|false
$aConfig['MVC_CLI'] = (('cli' === php_sapi_name()) ? true : false);
}
MODULES: {
// if a module has that file it is the primary one
$aConfig['MVC_MODULE_PRIMARY_ESSENTIAL'] = '/.primary';
// identify primary module
$aConfig['MVC_MODULE_PRIMARY'] = array_filter(
array_map(
function ($sValue) use ($aConfig){
return str_replace($aConfig['MVC_MODULE_PRIMARY_ESSENTIAL'], '', str_replace($aConfig['MVC_MODULES_DIR'] . '/', '', $sValue));
}, glob($aConfig['MVC_MODULES_DIR'] . '/*' . $aConfig['MVC_MODULE_PRIMARY_ESSENTIAL'])),
'trim'
);
$aConfig['MVC_MODULE_PRIMARY_NAME'] = current($aConfig['MVC_MODULE_PRIMARY']);
$aConfig['MVC_MODULE_PRIMARY_DIR'] = $aConfig['MVC_MODULES_DIR'] . '/' . $aConfig['MVC_MODULE_PRIMARY_NAME'];
$aConfig['MVC_MODULE_PRIMARY_CONFIG_DIR'] = $aConfig['MVC_MODULE_PRIMARY_DIR'] . '/etc/config';
$aConfig['MVC_MODULE_PRIMARY_CONTROLLER_DIR'] = $aConfig['MVC_MODULE_PRIMARY_DIR'] . '/Controller';
$aConfig['MVC_MODULE_PRIMARY_DATATYPE_DIR'] = $aConfig['MVC_MODULE_PRIMARY_DIR'] . '/DataType';
$aConfig['MVC_MODULE_PRIMARY_ETC_DIR'] = $aConfig['MVC_MODULE_PRIMARY_DIR'] . '/etc';
$aConfig['MVC_MODULE_PRIMARY_STAGING_CONFIG_DIR'] = $aConfig['MVC_MODULE_PRIMARY_CONFIG_DIR'] . '/' . $aConfig['MVC_MODULE_PRIMARY_NAME'] . '/config';
$aConfig['MVC_MODULE_PRIMARY_EVENT_DIR'] = $aConfig['MVC_MODULES_DIR'] . '/Event';
$aConfig['MVC_MODULE_PRIMARY_MODEL_DIR'] = $aConfig['MVC_MODULES_DIR'] . '/Model';
$aConfig['MVC_MODULE_PRIMARY_POLICY_DIR'] = $aConfig['MVC_MODULES_DIR'] . '/Policy';
$aConfig['MVC_MODULE_PRIMARY_VIEW_DIR'] = $aConfig['MVC_MODULES_DIR'] . '/View';
$aConfig['MVC_MODULE_PRIMARY_COMPOSER_DIR'] = $aConfig['MVC_MODULE_PRIMARY_CONFIG_DIR'] . '/' . $aConfig['MVC_MODULE_PRIMARY_NAME'];
// array for module configs
$aConfig['MODULE'] = array();
}
MVC_APPLICATION_SETTINGS_II:
{
/**
* MVC fallback routing
* this routing will be used if none is specified for routing
* Note: Possibility of a direct call (http|cli) of this route is disabled
*/
$aConfig['MVC_ROUTING_FALLBACK'] = $aConfig['MVC_ROUTE_QUERY_PARAM_MODULE'] . '=' . $aConfig['MVC_MODULE_PRIMARY_NAME'] . '&'
. $aConfig['MVC_ROUTE_QUERY_PARAM_C'] . '=index&'
. $aConfig['MVC_ROUTE_QUERY_PARAM_M'] . '=notFound';
}
MVC_TEMPLATE_ENGINE_SMARTY: {
$aConfig['MVC_VIEW_TEMPLATE_DIR'] = $aConfig['MVC_MODULE_PRIMARY_DIR'] . '/templates';
$aConfig['MVC_SMARTY_CACHE_STATUS'] = false;
$aConfig['MVC_SMARTY_CACHE_DIR'] = $aConfig['MVC_APPLICATION_PATH'] . '/cache';
$aConfig['MVC_SMARTY_TEMPLATE_DIR'] = $aConfig['MVC_VIEW_TEMPLATE_DIR'];
$aConfig['MVC_SMARTY_TEMPLATE_DEFAULT'] = 'Frontend/layout/index.tpl';
// templates_c directory and
// templates_c directory access rights, octal mode
$aConfig['MVC_SMARTY_TEMPLATE_CACHE_DIR'] = $aConfig['MVC_APPLICATION_PATH'] . '/templates_c';
// array Location of Smarty PlugIns
$aConfig['MVC_SMARTY_PLUGINS_DIR'][] = $aConfig['MVC_APPLICATION_PATH'] . '/smartyPlugins';
}
/**
* @see /application/doc/README "Policy"
* Policy Rules are bonded to a specific "Controller::Method"
* Define your policies
*/
MVC_POLICY: {
$aConfig['MVC_POLICY'] = array();
}
MVC_MISC: {
$aConfig['MVC_UNIQUE_ID'] = date('YmdHis') . '' . uniqid();
}
Example: /modules/Foo/etc/config/_mvc.php
<?php
/**
* @package Emvicy
* @copyright ueffing.net
* @author Guido K.B.W. Üffing <emvicy@ueffing.net>
* @license GNU GENERAL PUBLIC LICENSE Version 3. See application/doc/COPYING
*
* these configs here do extend and overwrite:
* `/config/_mvc.php`
*/
//-------------------------------------------------------------------------------------
// Module
//-------------------------------------------------------------------------------------
// MVC
// override default fallback routing
$aConfig['MVC_ROUTING_FALLBACK'] = $aConfig['MVC_ROUTE_QUERY_PARAM_MODULE'] . '=' . $aConfig['MVC_MODULE_PRIMARY_NAME'] . '&'
. $aConfig['MVC_ROUTE_QUERY_PARAM_C'] . '=index&'
. $aConfig['MVC_ROUTE_QUERY_PARAM_M'] . '=notFound';
// Add Location of Smarty PlugIns
$aConfig['MVC_SMARTY_PLUGINS_DIR'][] = realpath(__DIR__ . '/../../') . '/etc/smartyPlugins';
Example: /modules/Foo/etc/config/Foo/config/develop.php
<?php
/**
* @package Emvicy
* @copyright ueffing.net
* @author Guido K.B.W. Üffing <emvicy@ueffing.net>
* @license GNU GENERAL PUBLIC LICENSE Version 3. See application/doc/COPYING
*
* these configs here do extend and overwrite:
* `/modules/Foo/etc/config/_mvc.php`
*/
//######################################################################################################################
// Emvicy
declare(strict_types=1); // @see https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict
error_reporting(E_ALL);
date_default_timezone_set('Europe/Berlin');
// consider a logrotate mechanism for these logfiles as they may grow quickly
$aConfig['MVC_LOG_SQL'] = false; // consider to set to true for develop environments only: logging request into MVC_LOG_FILE_SQL
$aConfig['MVC_LOG_REQUEST'] = false; // consider to set to true for develop environments only: logging request into MVC_LOG_FILE_REQUEST
$aConfig['MVC_EVENT_LOG_RUN'] = false; // consider to set to true for develop environments only: logging of each simple "RUN" event into MVC_LOG_FILE_EVENT
$aConfig['MVC_LOG_AUTOLOADER'] = false; // consider to set to true for develop environments only: Log autoloader actions
$aConfig['MVC_INFOTOOL_ENABLE'] = true; // consider to set to true for develop environments only: show InfoTool bar
$aConfig['MVC_LOG_FORCE_LINEBREAK'] = true; // consider to set to true for develop environments only: force linebreaks in logfiles no matter what, improves readabilty of logs but blows up
//######################################################################################################################
// Module Foo
$aConfig['MODULE']['Foo'] = array();
// ...your config goes here...
//----------------------------------------------------------------------------------------------------------------------
// DB
// watch database log; e.g.: cd /tmp; tail -f Foo*.log
require realpath(__DIR__) . '/_db.php';
// consider a logrotate mechanism for this logfile as it may grow quickly
$aConfig['MODULE']['Foo']['DB']['logging']['general_log'] = 'ON'; // consider to set it to ON for develop or test environments only
//######################################################################################################################
// common settings
require realpath(__DIR__) . '/_datatype.php';
require realpath(__DIR__) . '/_session.php';
require realpath(__DIR__) . '/_csp.php';