Overview Configuration API
The Configuration API provides a central place for modules to store configuration data. This data can be simple configuration, such as your site name, or more complex information managed via configuration entities, such as views and content types.
Configuration is the place to store information that you want to synchronize from development to production. This information is often created during site building and typically not generated by regular users during normal site operation.
You should use the State API, not configuration, to store local variables that should not be transferred between instances. Use state for hidden system values, and when you never want to deploy them across environments. The system can be rebooted and all state lost. Configuration, however, is preserved.
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 for singleton use cases. A singleton is where only one instance of that configuration can exist. A good example would be the site name.
The Configuration Entity API should be used for storing multiple sets of configuration—such as node types, views, vocabularies, and fields.
Updating the Configuration API is crucial to avoid fatal errors when upgrading themes and modules to work in Drupal 8. See Upgrading themes and module upgrade information.
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.