The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

config(), state() and settings()

Submitted by nk on Wed, 2013-01-09 03:30

In Drupal 7 one could store every random thing not having its own table with variable_set and retrieved it with variable_get and life was simple. There was the $conf variable in settings.php which allowed an easy override. This worked well... until you wanted to copy variables from one server to the other. Or translate them. In Drupal 8, most variables have moved to config() and are still overrideable by $conf. There are a few exceptions. Variables specific to a given environment never needing deployment should use state() and these are not overrideable (it would make little sense as the overrides themselves are about making giving configuration variables environment specific values). The textbook example is the last time cron was run. Or the list of aggregated JS files. The list of path roots that have aliases. And so on. This is relatively rare. Even rare is the third API, variables that need to be available extremely early can be set in $settings in settings.php and retrieved with settings()->get(). This likely affects only people with somewhat higher end setups -- alternative cache backends, reverse proxies and the like.

Commenting on this Story is closed.

Submitted by Anonymous on Wed, 2013-01-09 07:24.

You describe settings() as config available early, which I interpret as something different than $conf inte settings.php.

Will there be any equivalent to $conf in settings.php in D8? It is very useful to have those hard overrides for a lot of things, particularly important config differences between staging and live server.

Submitted by Anonymous on Wed, 2013-01-09 07:45.

$conf is still there for overrides with only minor changes at the moment.

Submitted by nk on Wed, 2013-01-09 10:43.

Updated the post clarifying this.