The Drupal 8 API
Configuration Storage

Configuration Storage

Configuration information is stored in files and in the database.

Configuration File Format (YAML)

All configuration data is stored on-disk using YAML files.

Here is an example of a configuration file:

some_string: 'Woo kittens!'
some_int: 42
some_bool: true

Configuration can also be nested. Here is an example:

name: thumbnail
label: 'Thumbnail (100x100)'
effects:
  1cfec298-8620-4749-b100-ccb6c4500779:
    id: image_scale
    data:
      width: 100
      height: 100
      upscale: true
    weight: 0
    uuid: 1cfec298-8620-4749-b100-ccb6c4500779

See the section called “Configuration Schema and Meta-Data” for information on the schema for configuration files.

Configuration File Location for a Site

By default, when you install Drupal, the installer will create a randomly-named directory inside your public files directory for configuration. The name will start with config_, followed by a random hash string. Within this directory, the installer will create an active directory for your current live configuration, and a staging directory for configuration you are importing.

You can change the locations of your staging and active directories by editing your settings.php file.

Default Configuration for a Module

A module that provides default values for its configuration must put that configuration into YAML files in its config sub-directory.

If the module only needs basic Simple Configuration settings, all of the default configuration could go into one modulename.settings.yaml file. For more complex settings, you can separate your configuration into multiple files. Configuration Entities must each be put into their own YAML files, and they should be generated by having the module write out its configuration (don’t try writing them by hand).

Configuration Caching in the Database

The canonical storage for configuration for a site is the files in the active configuration directory defined in settings.php. However, by default, Drupal table. (Of course, you can override Drupal’s default cache system.)