operations / drupal-settings
Automatic Drupal Settings.
Fund package maintenance!
jonpugh
Patreon
Open Collective
thinkdrop.net
- 2.x-dev
- 2.1.0
- 2.1.0-beta4
- 2.1.0-beta3
- 2.1.0-beta2
- 2.1.0-beta1
- 2.0.0-beta15
- 2.0.0-beta14
- 2.0.0-beta13
- 2.0.0-beta12
- 2.0.0-beta11
- 2.0.0-beta10
- 2.0.0-beta9
- 2.0.0-beta8
- 2.0.0-beta7
- 2.0.0-beta6
- 2.0.0-beta5
- 2.0.0-beta4
- 2.0.0-beta3
- 2.0.0-beta2
- 2.0.0-beta1
- 1.x-dev
- 1.10.0-alpha11
- 1.10.0-alpha10
- 1.10.0-alpha9
- dev-feature/oop
- dev-feature/pantheon-settings
- dev-feature/scripts
- dev-feature/tasks
- dev-feature/composer-project-bins
This package is auto-updated.
Last update: 2024-12-11 16:54:12 UTC
README
This PHP Package is a smart include for Drupal settings.php.
Add it to your project to simplify your settings.php file by using common defaults for each hosting vendor and environment types.
It just makes things easier. For example, when using Lando, you don't have to set the database settings or DRUSH_OPTIONS_URI, and it automatically enables development mode.
Usage
-
Install with composer:
composer require operations/drupal-settings`
-
Add snippet to sites/default/settings.php:
if (file_exists(DRUPAL_ROOT . "/../vendor/operations/drupal-settings/Settings/settings.include.php")) { require DRUPAL_ROOT . "/../vendor/operations/drupal-settings/Settings/settings.include.php"; }
-
Profit.
To override any defaults provided by settings.include.php
, simply add them to your settings.php file after the snippet.
Components
-
Drupal Settings Include File - settings.include.php
Include this file from settings.php and remove all the extra settings. For full documentation on what it does, see the file ./Settings/settings.include.php.
-
Vendor-specific settings files - Included automatically when their environment variables are detected.
-
Composer Autoload File - autoload.php
This file is included in your site's Autoloader as early as possible.
It is used to set Environment variables like DRUSH_OPTIONS_URI automatically.
Features
This tool attempts to automate as much configuration as possible for multiple host providers.
The main features are:
- Detect host vendor environments and includes
settings.VENDOR.php
files automatically. - Sets
$databases
credentials from host vendor information, or usesMYSQL_USER
-style variables. - Sets
DRUSH_OPTIONS_URI
globally so any call to drush has the correct URL. - Sets
DRUPAL_ENV
environment variable toprod
when a production environment is detected. (Defaults todev
). - Includes environment specific
settings.DRUPAL_ENV.php
files from this project andsites/default/settings.DRUPAL_ENV.php
from your site's source code if it exists. - Automatically enables development features when
DRUPAL_ENV==dev
by including Drupal'sexample.settings.local.php
.
Supported Providers
- Lando
- DDEV
- Platform.sh
- Acquia
- OpenDevShop
We invite all other systems to submit merge requests to the project here: https://git.drupalcode.org/project/ox/-/tree/1.x/src/composer/Plugin/DrupalSettings/Settings/Vendors
Development
This tool is a part of the Drupal Operations / OX project. The code is maintained in the monorepo "ox".
See https://git.drupalcode.org/project/ox for more information.