Version Identifiers

Last updated on
10 July 2025

A Version Identifier is an optional string that appears alongside your environment name (Development, Staging, Production, Localhost, etc.) to show exactly which code or release version is running—whether via Git data, a deployment tag, or the Drupal core version.

A toolbar that is normally black, with a red background indicating the environment, additionally the name of the environment is printed as Localhost, and the version indicator says 10.0.11

Primary Sources

  • Environment Indicator Current Release (default)

    • Reads environment_indicator.current_release from the state API.

  • Deployment Identifier

    • The deployment identifier mechanism is provided by Drupal core and is used by various hosting providers. It is a string that can be used to identify a particular deployment of your site. This is useful for identifying the specific code or configuration version currently deployed. The deployment identifier can be set in the settings.php file or through other mechanisms in your deployment process.

  • Drupal Core Version

    • ​​The currently installed version of Drupal. Tagged releases only.

  • None

    • Don't display any version identifier.

How to Configure via the UI

Go to Administration » Configuration » Development » Environment Indicator Settings

  1. Select your primary source from the "Source of version identifier to display" select element.

  2. Select your fallback source from the "Fallback source of version identifier" select element.

    • If your primary source is empty or missing, pick one of the same options above as a fallback. Choosing None as your primary source disables fallback behavior.

  3. Click Save configuration.

How to Configure via Drush

# Set primary source (e.g. deployment_identifier)
drush config:set environment_indicator.settings version_identifier deployment_identifier

# Set fallback source (e.g. environment_indicator_current_release)
drush config:set environment_indicator.settings version_identifier_fallback environment_indicator_current_release

# Rebuild caches
drush cr

Using a static message with the "version identifier" feature.

Put a text string into environment_indicator.current_release to be displayed in the version identifier slot.

drush state:set environment_indicator.current_release "Hello World!"

Using git information with the "version identifier" feature.

Put a git version string into environment_indicator.current_release to be displayed in the version identifier slot.

Branch + tag + commit:

drush state:set environment_indicator.current_release "$(git describe --contains --all HEAD; echo " "; git describe --always)"

Captures the current branch followed by the latest tag, number of commits since the tag, and the short current commit hash (e.g. dev 0.6.1-8-g629134f).

Tag + commit only:

drush state:set environment_indicator.current_release "$(git describe --always)"

Captures only the latest tag, number of commits since the tag, and the short current commit hash (e.g. 0.6.1-8-g629134f).

Using the Deployment Identifier in settings.php.

Drupal's dependency injection container will be automatically invalidated and rebuilt when the Drupal core version changes. When updating contributed or custom code that changes the container, changing this identifier will also allow the container to be invalidated as soon as code is deployed.

Typically set in the settings.php file or through your deployment process.

Example: $settings['deployment_identifier'] = \Drupal::VERSION;

Help improve this page

Page status: No known problems

You can: