

Posted in
March 7, 2018
It’s amazing how, just a couple of years ago, Drupal 8 was in its initial stages and getting ready for its first stable release. But now, in 2018, we have stable releases and contributed module development on D8 has been progressing rapidly (as of this writing, we’re at nearly 5,000 D8 modules). CiviCRM, the best open source customer management tool, is one such community-contributed integration that has been making such Drupal 8 strides.
When one of our clients needed their D7 CiviCRM ported over to their new D8 site, the prospects were not good: CiviCRM seemed to be lagging behind and the general online consensus was that things weren’t working, and boy are we glad the internet was wrong. The people behind the open-source content management framework has gotten its D8 version out and interestingly, most of it works beautifully. To our surprise (and relief!), the integration with the D8 site went incredibly well, of course, with a few kinks here and there. Those kinks are primarily due to the fact that Civi ships with its own Symfony version, which is a different version than what Drupal uses and that causes a conflict. For more information on it, read here.
We were able to do our Civi installation by following the steps mentioned in the wonderful blog by David Snopek. So, even though it was a bit complicated, it was definitely a learning experience for us and we thought we would share some of that knowledge here. In this blog we’ll be detailing how to install the richly packed Customer Relationship Management tool called CiviCRM on an existing Drupal 8 Commerce 2 ecommerce store. However, if you’d like to install a new Vanilla Drupal Commerce 8 site with CiviCRM already setup, we’d suggest you follow the easy-to-use instructions in Snopek’s blog.
In Drupal 8, installing CiviCRM is a bit more complicated than doing just a simple...
$ composer require drupal/civicrm...like you would for other modules.
If you are waiting for a more standardized policy/process for installing Civi, it might not be in the near future, as the maintainers feel that we already have a process that works and they want to spent their time concentrating on getting the actual module more stable and fixing functional bugs. They also need to come together and agree upon what is the best way to organize the code and do its build. So, the process to get it installed on a D8 installation requires quite a few steps, but if you do it right, it will work.
Below we’ve tried to slim down those steps and made it a bit more concise, so that, essentially, all you would need to do is copy and paste the commands and be on your way to using a fully integrated CiviCRM on top of Drupal 8. It took us a couple of attempts to get it right when we first installed it as some of the steps were in different places and missing a step would mean you had to start over.
Prerequisites:
Note: as CiviCRM Core hasn’t been added to Packagist yet, we’ll be using David Snopek’s fork.
Run civicrm_setup.sh from your project root directory.
bash ./civicrm_setup.shThis will download all the necessary modules and dependencies needed to install CiviCRM.
Get the Civi theme to apply by going to "/civicrm/admin/setting/url?reset=1" and set the CiviCRM Resource URL to "/libraries/civicrm" and click “Save”.

If everything worked correctly, you should see a CiviCRM link up at the top.

Click on the CiviCRM link and you should be taken to a page like this:

You can also confirm that the module is actually working by typing in the email of the user that you are logged in as, and it should bring up the contact in CiviCRM. This means that contacts are automatically being synced between Drupal and CiviCRM.

And that is it! You can throw your hands up in the air to celebrate, as you’ve just installed CiviCRM in a matter of minutes.
Would you like other apps integrated into your Drupal Commerce website, but need a hand doing it? We've done it many times and would love to help.