roundearth / drupal-civicrm-project
Project template for Drupal projects with CiviCRM
Requires
- civicrm/civicrm-asset-plugin: ^1.0
- civicrm/civicrm-drupal-8: ^5.24.0
- civicrm/civicrm-packages: ^5.24.0
- composer/installers: ^1.2
- cweagans/composer-patches: ^1.6.5
- drupal/core-composer-scaffold: ^8.8.4
- drupal/core-recommended: ^8.8.4
Requires (Dev)
- drupal/core-dev: ^8.8.4
Conflicts
This package is auto-updated.
Last update: 2025-03-01 00:14:16 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:
Ensure the
web/sites/default
directory is writeable. On the command-line:chmod +w web/sites/default
Enable the CiviCRM module. On the command-line:
drush en -y civicrm
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