Documentation

Configuration
in package

The Configuration class retrieves configuration variables from an .ini file.

It requires the path to the configuration file. As for security, keeping the configuration file out of the web root is the first step. Making it read-only and restricting access may make it more secure. The .ini files have a trivial syntax so they are easy to edit and understand. Also it is the syntax of PHP configuration files.

 [application]
 name=foo

 [template]
 name=bar

 [sqlite]
 database=/path/to/file.sqlite

And then:

 $c = new \netico\Bones\Configuration();
 $name = $c->getValue('application', 'name');
 print $name;
Tags
link
https://git.lattuga.net/netico/code-library/src/master/Framework
copyright

Copyright (c) 2016, 2022 netico netico@riseup.net

license

https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License

author

netico netico@riseup.net

Table of Contents

__construct()  : void
This code works if you set the CONFIG constant.
getValue()  : string
This method gets a configuration option.

Methods

__construct()

This code works if you set the CONFIG constant.

public __construct() : void
Return values
void

getValue()

This method gets a configuration option.

public getValue(string $section, string $name) : string
Parameters
$section : string

Section in INI file (for example: '[section]').

$name : string

Key in file INI (for example: 'key=').

Return values
string

Value (for example: '=value').

Search results