Config

File /config.php defines global array $CONFIG. You can add your keys and use them via global array $CONFIG.

Example

<?php
global $CONFIG;
$CONFIG = [
	'debug'     => true,
	'cores'     => [
		'/site' => $_SERVER['DOCUMENT_ROOT'] . '/site',
		'/core' => $_SERVER['DOCUMENT_ROOT'] . '/core',
	],
	'roots'     => [
		'/site/root' => $_SERVER['DOCUMENT_ROOT'] . '/site/root',
		'/core/root' => $_SERVER['DOCUMENT_ROOT'] . '/core/root',
	],
	'languages' => [
		//'en' => 'English',
		//'ru' => 'Русский',
	],
	'modules'   => [
		'System',
		'Admin',
		//'Testing',
		//'<your namespace>',
	],
	'database'  => [
		'HOST'     => 'localhost',
		'PORT'     => 3306,
		'USER'     => '',
		'PASSWORD' => '',
		'DATABASE' => '',
	],
	'template'  => 'bootstrap',
	'redirects' => [
		// 'System\\Engine' => '<your namespace>\\Engine',
		'System\Database' => 'System\DatabaseDriverMySQL',
	],
];
return $CONFIG;

  • /site -- directory with your core
  • /core -- directory with framework (which is also the core)

Keys meaning

debug
bool, set this to true to allow global function debug() to work
cores
dictionary of cores:
  • key - relative path to core folder
  • value - absolute path to core folder
  • first key has top priority
    roots
    dictionary of roots:
  • key - relative path to root
  • value - absolute path to root
  • first key has top priority
    languages
    dictionary of languages (may be empty):
  • key - symbolic code of language
  • value - name of language
  • first element is the default language
    modules
    list of modules
    database
    dictionary of details for connecting to the database, vary by driver
    template
    string, code of template used by default
    redirects
    dictionary, describing classes overriding:
  • key - class that needs to be overridden
  • value - class to override with
  • remember that you can successfully override class only with it's children
    Ask question