Notes: Drupal 8 with Composer

Just some notes I jotted down while managing a first Drupal 8 site entirely with composer.

Local Setup

Composer template for Drupal projects. Quick installation via composer create-project drupal-composer/drupal-project

This project template should provide a kickstart for managing your site dependencies with Composer.

Further Info: Composer template for Drupal projects


Initial Deployment:

  1. Transfer composer.json and composer.lock to your server.
  2. Transfer the directory scripts (and its contents) manually to your server. At least for me Composer didn’t manage to create it.
  3. Make the Root-Directory writable.
  4. Exectute composer install .
  5. Manually transfer the files (not directories) in the root level of the web directory if they haven’t been created by Composer (web/*.php und web/.htaccess).
  6. Import a MySQL-Dump and add credentials to either settings.php (if deploying to production) or settings.local.php when deploying to a stage environment. Make sure to include local settings and don’t mix up local settings of different instances.

Backup Migrate with Composer

Generally editing a composer.json file directly is frowned upon. Installing this with the command line worked for me in a three step process.

Add the vcs repository dependency:

composer config repositories.backup_migrate vcs https://github.com/backupmigrate/backup_migrate_core

Note you can call the repository what you want.

Add psr/log dev dependency: composer require "psr/log":"dev-master"

Add backup migrate composer require drupal/backup_migrate

This worked for the backup_migrate alpha

Source Problem installing with composer. #2822885 | Drupal.org


Need a great new website or a helping hand with Drupal? Head over to www.klickreflex.de or contact me directly to see if we can work something out.