Talking through the growing pains of using Drupal with Composer dependency management at DrupalCon Baltimore. Drupal gets better when companies, organizations, and individuals build or fix something they need and then share it with the rest of us. Open source technologies become better, stronger, and smarter when others take it upon themselves to make a positive difference contributing their knowledge, time, and energy to it. Acquia is proud to play a part, alongside thousands of others, in making tomorrow’s Drupal better than today’s. One of the people making a difference is Jeff Geerling.
Jeff Geerling (geerlingguy), Senior Technical Architect at Acquia, is a prolific and valued open source contributor. He has 150+ open source projects around both the Ansible and Drupal projects. His Drupal modules are used by almost 100,000 sites. I spoke with him about the BoF session he set up at DrupalCon Baltimore, Managing Drupal Sites with Composer.
“Drupal 8 doesn’t ‘officially’ require Composer to be used, but if you build any typical Drupal 8 site, you’ll quickly run into walls if you don’t or can’t use Composer.” – Jeff Geerling
jam: How did your BoF come about?
Jeff Geerling: Composer has been around for a few years, but only recently reached stable status, and Drupal 8 is the first version of Drupal where people are really getting on board using Composer for Drupal dependency management. Drupal 8 doesn’t ‘officially’ require Composer to be used, but if you build any typical site, you’ll quickly run into walls if you don’t or can’t use Composer. There are a lot of growing pains right now and I didn’t just want to stand in front of a room telling people what I know–it’s hard for me to learn anything new that way! A BoF discussion is the ideal format in this case. I wanted to get together with people to talk about the hard problems and see if we could all share our best practices, learn, and hopefully make each other’s lives easier. I was hoping for a range of perspectives and use cases in the conversation: developers, site builders, and devops/sysadmins who have used Composer before, and people interested in installing modules with Composer dependencies (like Solr or Drupal Commerce).
jam: What value does managing Drupal sites with Composer deliver to …
- … developers? Jeff Geerling: Composer promises to make it easier to live in a ‘Proudly Invented Elsewhere’ world. Also, if you use it right, it can help you identify insecure versions, safely patch modules and Drupal core if needed, and even upgrade everything even more easily than when we only had Drush available.
- … site owners and businesses? Jeff Geerling: You can have more assurance that your codebase is not hacked, and you can reliably reproduce your site without having to store all the community code in your own code repository.
- … the Drupal community? Jeff Geerling: Using Composer allows us to work in, integrate with, and contribute to the wider PHP community in the age of PHP interoperability much more easily than ever before.
jam: What did you learn in the BoF and why is knowing more about managing Drupal sites with Composer important?
Jeff Geerling: Dependency management is a big, crucial topic area. I went in with a few questions and ideas, like talking about integrating frontend libraries, the D8 Libraries API and Composer, custom projects, patches … There are a lot of people who feel like they’ve been left behind because they aren’t familiar with Composer, and we don’t want these developers and others to abandon Drupal 8 because they run into dependency issues. In the end, the group that assembled for the BoF identified more than 20 common pain points people are having with Composer, and for many of them, we discussed ways to overcome the problems. However, there are still a few open questions, or problems which could be solved in a number of different ways (some better than others). We’re not there yet on making sure Composer is a pleasure to use in every case, instead of a pain in a few 🙂
Learnings: Jeff organised his notes from the DrupalCon Baltimore BoF and published them in a blog post: Composer and Drupal are still strange bedfellows.
jam: What is the state-of-play and what is coming next regarding managing Drupal sites with Composer?
Jeff Geerling: As of early-mid 2017, there are still unanswered questions in the community surrounding Composer: Are we going to include Composer with core? Should we commit the core composer.lock file to Drupal’s codebase? How should you set up a new Drupal site if you’re using Composer? How do you or should you add front-end libraries required by modules (e.g. Font Awesome, Webform) with Composer?
Resources: Drupal + Composer + geerlingguy
- Tips for Managing Drupal 8 projects with Composer (Feb 2017 – blog post)
- Managing Drupal Site with Composer (DrupalCon Baltimore BoF proposal)
- Composer and Drupal are still strange bedfellows (May 2017 – DrupalCon Baltimore BoF notes)
- Buy Jeff’s book, Ansible for DevOps! It’s gotten great reviews.
- Just keep swimming: Don’t drown in your open source project! (May 2017 – DrupalCon Baltimore session). Also see Jeff’s post about that session on his blog.