roundearth/drupal-civicrm-project

Project template for Drupal projects with CiviCRM

8.x-dev 2020-04-21 14:45 UTC

This package is auto-updated.

Last update: 2021-03-29 00:46:05 UTC


README

This project template provides a starter kit for managing your Drupal 8 and CiviCRM site with Composer.

It's based on drupal/recommended-project, so please see that documentation for general information on managing Drupal via composer.

The documentation here is going to be focused on CiviCRM!

Usage

You need a couple of dependencies first:

Make sure that you have a recent version of Composer! A couple of people have tried to use this project with older versions and have experienced issues.

After that you can create your new project via:

composer create-project roundearth/drupal-civicrm-project:8.x-dev some-dir --no-interaction

Drupal will be installed under the web directory, with the vendor directory outside of the webroot. This follows current best practices, but it means two additional things:

  • You'll need to point your webserver at the web directory, not the top-level directory like you might be used to with Drupal 7, or non-composer Drupal 8 sites.
  • The CiviCRM web assets are synced to the web/libraries/civicrm directory, so you'll need to configure CiviCRM's "Resource URL" to point to the URL that will reach that directory.

Installing CiviCRM

After getting the code using the command-line above, and doing the normal Drupal 8 installation, perform the following steps to install CiviCRM:

  1. Ensure the web/sites/default directory is writeable. On the command-line:

     chmod +w web/sites/default
    
  2. Enable the CiviCRM module. On the command-line:

     drush en -y civicrm
    
  3. If you were already logged into the Drupal site, then logout and log back in again. This is to work around bug CRM-19878.

How does it work?

It's basically 'drupal/recommended-project' with a special Composer plugin added, which does all the additional steps for CiviCRM. So, if you want to understand its behavior or contribute, see the Composer plugin:

https://lab.civicrm.org/dev/civicrm-asset-plugin

References