PEAR_Config::set() – Set config value in specific layer


require_once 'PEAR/config.php';

bool PEAR_Config::set ( string $key , string $value , string $layer = 'user' )


Set a config value in a specific layer (defaults to 'user'). Enforces the types defined in the configuration_info array. An integer config variable will be cast to int, and a set config variable will be validated against its legal values.


string $key

config key

string $value

config value

string $layer

config layer

Return value

bool - Returns TRUE on success, FALSE on failure.


This function can not be called statically.

Temporarily remove an entire config layer (Previous) Set the list of channels. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

Note by:
This is a normal "setter" - not a "pear config-set" equivalent.

It doesn't save the setting(s) (write it/them to the configuration file). It just sets the setting in runtime configuration. (Which is cool btw. because I had a use case where I indeed wanted the setting to affect only while my app was running.)

You can save the settings with the writeConfigFile() method.