Skip to main content
Last Reviewed: 2026-03-12

Setup Drupal

Configure a Drupal GitHub repository for Pantheon's GitHub integration with the required file structure and platform settings.


This page describes how to configure a Drupal 11 repository for Pantheon's GitHub integration. Unlike WordPress, Drupal on Pantheon uses Integrated Composer — most Pantheon-specific configuration is handled automatically by the pantheon-systems/drupal-integrations Composer package.

Summary of Differences

ItemStandard Drupal 11Pantheon Drupal 11
composer.jsonDrupal core dependenciesAdds pantheon-systems/drupal-integrations, scaffold config, Quicksilver installer path
pantheon.upstream.ymlDoes not existRequired — platform infrastructure config with build_step: true
settings.phpGenerated during installPre-configured to include settings.pantheon.php
settings.pantheon.phpDoes not existAuto-generated by the drupal-integrations package
.gitignoreStandard DrupalModified — excludes Composer-managed dependencies
web/core/, vendor/, contribCommitted or variesNOT committed — built by Integrated Composer on deploy

How Drupal Integration Works

Add pantheon-systems/drupal-integrations as a Composer dependency. This package uses Drupal's scaffold system to automatically generate settings.pantheon.php and related files during composer install. Pantheon's build system runs composer install on deploy (enabled by build_step: true in pantheon.upstream.yml). Drupal core, contrib modules, and vendor/ are NOT committed to Git — they are built on deploy.

Directory Structure

Items marked (Pantheon) are additions or modifications. Items marked (Built) are generated at build time and should NOT be committed.

Modified Files

composer.json

This is the most important file. It configures Pantheon-specific dependencies, installer paths, and build hooks.

Key differences from a standard drupal/recommended-project:

ComponentStandard DrupalPantheon Drupal
pantheon-systems/drupal-integrationsNot presentRequired — scaffolds settings.pantheon.php
drupal-scaffold.allowed-packagesOnly drupal/coreAlso allows pantheon-systems/drupal-integrations
drupal-scaffold.file-mappingDefaultDisables scaffolding of .editorconfig, pantheon.upstream.yml, .gitattributes
Quicksilver installer pathNot presentMaps type:quicksilver-script to web/private/scripts/quicksilver/
config.platform.phpNot set or variesMust match php_version in pantheon.upstream.yml
cweagans/composer-patchesNot presentIncluded for patching support

It is expected that you will update this file from the original and Pantheon does not maintain it for you.

Source: composer.json

Warning:
PHP Version

The config.platform.php value in composer.json must match the php_version in your pantheon.upstream.yml. If they differ, dependency resolution may install packages incompatible with your runtime PHP version.

pantheon.upstream.yml

SettingPurpose
api_versionPantheon config API version (always 1)
web_docrootTells Pantheon the web root is web/ (not repository root). Required for Drupal.
enforce_httpsHTTPS enforcement mode
php_versionPHP runtime version (Drupal 11 requires 8.3+)
database.versionMariaDB version
drush_versionDrush version for Pantheon's cron/CLI operations
build_stepEnables Integrated Composer — Pantheon runs composer install on deploy. Required.
protected_web_pathsPaths blocked from public web access
Warning:
Critical

build_step: true and web_docroot: true are essential. Without build_step, Pantheon will not run Composer and your dependencies (including Drupal core) will be missing. Without web_docroot, Pantheon will serve from the repository root instead of web/.

Source: pantheon.upstream.yml

settings.php

The Pantheon version of settings.php is pre-configured to load Pantheon-specific settings and support local development overrides.

This file is generated by the drupal-integrations package automatically during composer install. It includes logic to load settings.pantheon.php when on Pantheon, and allows for local overrides when developing locally.

Source: web/sites/default/settings.php

.gitignore

The .gitignore is configured for the Integrated Composer workflow. Since Pantheon runs composer install on deploy, dependencies must NOT be committed.

Key rules:

  • /web/core/, /web/modules/contrib/, /vendor/ — all built by Composer on deploy
  • /web/sites/*/files — user uploads managed by Pantheon's filesystem
  • !/web/sites/*/services.pantheon.*.yml — exception to allow Pantheon services YAML files

Source: example .gitignore

The drupal-integrations Package

The pantheon-systems/drupal-integrations package is the key bridge between Drupal and Pantheon. It uses Drupal's scaffold system to automatically deploy configuration files.

What it scaffolds on composer install:

FileTargetOverwrite?
settings.pantheon.phpweb/sites/default/settings.pantheon.phpYes (on every composer install)
default.services.pantheon.preproduction.ymlweb/sites/default/default.services.pantheon.preproduction.ymlYes
settings.phpweb/sites/default/settings.phpNo (only if missing)

What settings.pantheon.php does (you don't write this — it's auto-generated):

  • Reads database credentials from $_SERVER['PRESSFLOW_SETTINGS'] (Pantheon-injected JSON)
  • Sets hash_salt from $_ENV['DRUPAL_HASH_SALT']
  • Configures file paths (private files, temp, config sync)
  • Places Twig cache in Pantheon's rolling temp directory (refreshed on each deploy)
  • Registers PantheonServiceProvider11 to clear Pantheon's edge cache on Drupal cache rebuilds
  • Sets trusted host patterns to .* (Pantheon handles domain routing)
  • Loads environment-specific services YAML (preproduction vs. production)

Version compatibility: Use ^11 for Drupal 11. The package conflicts with Drupal versions outside the 11.x range.

upstream-configuration Directory (Optional)

The upstream-configuration/ directory is used for Pantheon's custom upstream feature. It contains:

  • An empty composer.json where you can add shared dependencies
  • A ComposerScripts.php that automatically aligns config.platform.php with your Pantheon PHP version

This is optional unless you are using a custom upstream. Use the pantheon-systems/upstream-management package to manage upstream dependencies separately from your site-specific dependencies.

The ComposerScripts.php ensures that the PHP version used for dependency resolution always matches the runtime PHP version defined in pantheon.upstream.yml, preventing incompatible packages from being installed.

Checklist

Use this checklist to verify your Drupal 11 repository is ready for Pantheon's GitHub integration:

  • composer.json includes pantheon-systems/drupal-integrations: ^11 as a dependency
  • composer.json has drupal-scaffold.allowed-packages including pantheon-systems/drupal-integrations
  • composer.json has config.platform.php matching the PHP version in pantheon.upstream.yml
  • pantheon.upstream.yml (or pantheon.yml) exists with api_version: 1, web_docroot: true, build_step: true, php_version, and database.version
  • web/sites/default/settings.php includes settings.pantheon.php and optionally settings.local.php
  • .gitignore excludes vendor/, web/core/, web/modules/contrib/, web/themes/contrib/, and web/sites/*/files
  • config/ directory exists with an .htaccess denying web access
  • composer.lock is committed
  • Drupal core and contrib modules are NOT committed
  • web/sites/*/files/ is NOT committed

More Resources