Config Property

The $config property contains about object from selected Seme Framework file configuration. While accessing this property, every variables that existing on configuration will be converted as object.

Basic Usage

Here is the basic usage $config property method from SENE_Controller class.



The value of $object_config_name value can be a string, object, or array depends on value that existing on configuration.


Here is the example usage config property in a controller file.

//print the database connection host
echo $this->config->db['host'];

Get Current Configration File

Seme Framework allows 3 different configration there is development.php, staging.php, and production.php. If we want to know which setting is being used, we can do this by calling this $config property. Let's take a look at the sample code snippet in a controller class below.

echo $this->config->environment;
// will print:
// - development, or
// - staging, or
// - production

Semevar Property

The $this->config->semevar property is an object of the $semevar variable in the Seme Framework settings file. This property is used to retrieve hardcode values for application development needs.

In this example, we will see how to retrieve the $semevar value from the settings file into the $this->config property in a controller file. The following is an example of the contents of the $semevar array in the Seme Framework settings file.

$semevar['site_name'] = 'Cipta Esensi Merenah';
$semevar['site_version'] = '1.0.0';

And then on controller, we can get the values from config through controller.

echo $this->config->semevar->site_name.' v'.$this->config->semevar->site_version;