Constructor of this class.
void
ConfigMagik
([string $path = null], [bool $synchronize = false], [bool $process_sections = false])
-
string
$path: Path to ini-file to load at startup.
NOTE: If the ini-file can not be found it will try to generate one there. By not specifing an ini-file the configuration will be kept in-memory till you call save().
-
bool
$synchronize: TRUE for constant synchronisation of memory and file (default is disabled).
-
bool
$process_sections: TRUE to enable sections in your ini-file (default is disabled).
Get value of given key from given section (if any used).
mixed
get
([string $key = null], [string $section = null])
-
string
$key: Key or name of directive to set in current config.
-
string
$section: Name of section to set key/value-pair therein.
NOTE: Section must only be specified when sections are enabled in your ini-file.
Loads and parses ini-file from filesystem.
bool
load
([string $path = null])
-
string
$path: Optional path to ini-file to load.
NOTE: When not provided, path passed to constructor will be used.
Remove a directive (key and it's value) from current config.
bool
removeKey
(string $key, [string $section = null])
-
string
$key: Name of key to remove form current config.
-
string
$section: Optional name of section (if used).
Remove entire section from current config.
bool
removeSection
(string $section)
-
string
$section: Name of section to remove.
Writes ini-file to filesystem as file.
bool
save
([string $path = null])
-
string
$path: Optional path to write ini-file to.
NOTE: When not provided, path passed to constructor will be used.
Sets a given value (in given section, if any specified) in current configuration.
bool
set
(string $key, mixed $value, [string $section = null])
-
string
$key: Key or name of directive to set in current config.
-
mixed
$value: Value of directive to set in current config.
-
string
$section: Name of section to set key/value-pair therein. NOTE: Section must only be specified when sections are enabled in your ini-file.