The Drupal community has been on an interesting journey since the launch of Drupal 8 in 2015. In the past three years, as the community has started to get its sea legs 'off the island' (using tools, libraries, and techniques used widely in the general PHP community), there have been growing pains.
One area where the pains have been (and sometimes still are) highly visible is in how Drupal and Composer work together. I've written posts like Composer and Drupal are still strange bedfellows in the past, and while in some ways that's still the case, we as a community are getting closer and closer to a nirvana with modern Drupal site building and project management.
For example, in preparing a hands-on portion of my and Matthew Grasmick's upcoming DrupalCon Nashville lab session on Composer and Drupal, I found that we're already to the point where you can go from literally zero to a fully functional and complete Drupal site codebase—along with a functional local development environment—in about 10 or 15 minutes:
- Make sure you have PHP, Composer, and Docker CE installed (Windows users, look here).
- Create a Drupal codebase using the Drupal Composer Project:
composer create-project drupal-composer/drupal-project:8.x-dev drupal8 --stability dev --no-interaction
- Open the project directory:
- Add a plugin to build a quick and simple local dev environment using Drupal VM Docker Composer Plugin:
composer require --dev geerlingguy/drupal-vm-docker
- Start the local dev environment:
docker-compose up -d
- Open a browser and visit http://localhost/
I'm not arguing that Drupal VM for Docker is the ideal local development environment—but accounting for about one hour's work last night, I think this shows the direction our community can start moving once we iron out a few more bumps in our Composer-y/Drupal-y road. Local development environments as Composer plugins. Development tools that automatically configure themselves. Cloud deployments to any hosting provider made easy.
Right now a few of these things are possible. And a few are kind of pipe dreams of mine. But I think this year's DrupalCon (and the follow-up discussions and issues that will result) will be a catalyst for making Drupal and Composer start to go from being often-frustrating to being extremely slick!
If you want to follow along at home, follow this core proposal: Proposal: Composer Support in Core initiative. Basically, we might be able to make it so Drupal core's own Composer usage is good enough to not need a shim like drupal-composer/drupal-project, or a bunch of custom tweaks to a core Composer configuration to build new Drupal projects!
Also, I will be working this DrupalCon to help figure out new and easier ways to make local development easier and faster, across Mac, Linux and Windows (I even brought my clunky old Windows 10/Fedora 26 laptop with me!). There are a number of related BoFs and sessions if you're here (or to watch post-conference), for example:
- Improving Drupal's Evaluator experience - BoF, 10:45-11:45 a.m. Tuesday
- Top 8 considerations for choosing a local development environment - Session, 10:45-11:45 a.m. Tuesday
- 2018 Drupal Developer Survey Results - BoF, 12:00-1:00 p.m. Tuesday
- Drupal Core Auto-Update Architecture - Session, 1:00-2:00 p.m. Tuesday
- An official Drupal local development environment? - BoF, 10:45-11:45 a.m.
- How to build a Drupal site with Composer AND keep all of your hair - Session, 3:45-6:00 p.m.