Configuration API overview

Last updated on
19 September 2019

The configuration API provides a central place for modules to store configuration data. This data can be simple configuration like your site name, or more complex information managed with configuration entities, such as views and content types.

Configuration is a place to store information that you would want to synchronize from development to production. This information is often created during site-building and is not typically generated by regular users during normal site operation.

You should use the State API, not configuration, for storing local variables that shouldn't travel between instances. Use state for hidden system values, and if you never want to deploy it between environments. You can reset a system, losing all state. Its configuration remains.

The configuration API comes in two flavors - the (simple) Config API and the Configuration Entity API. The key difference is that the Config API is the singleton use case. A singleton is where there can be only a single instance of this configuration. A good example would be the site's name.

The Configuration Entity API should be used to store multiple sets of configuration - for example node types, views, vocabularies, and fields.

Updating the configuration API is vital to avoid fatal errors when updating themes and modules to work in Drupal 8. See Updating themes and updating modules info.

Help improve this page

Page status: No known problems

You can: