Update: Drupal 9 was released on June 3rd. Since Drupal 9 is essentially a cleaned up version of Drupal 8 with deprecated code removed so this article applies to Drupal 9 as well.
The first stable release of Drupal 8 was on November 19, 2015 and it represented a significant improvement over previous versions in a number of key areas.
Drupal 8 Represents Significant Improvements over Drupal 7
There was a tremendous amount of work building Drupal 8. Drupal 8 is much better than Drupal 7 in a number of ways and it is highly recommended to upgrade from Drupal 7 if you have not done so already. Some of the areas that are improved include:
- Performance - advanced caching using BigPipe
- Security - updated software, and requirements for newer, more secure versions of php, mySQL and Apache
- Layout Builder - drag and drop page builder
- Workspaces - improved workflow and version management for content editors
- Improved user experience - better user experience for content editors and site managers through an improved UI and Claro admin theme
- Future proofed - Drupal 8 is built to be easily updated in the future so the type of re-inventing the wheel that has happened in the past will not happen anymore. Drupal 9 is being developed inside Drupal 8 and will be a much smoother upgrade than previous major version upgrades.
In spite of all the improvements in Drupal 8, there are also a number of hurdles that need to be overcome when upgrading.
Drupal Upgrade Challenges
From a site builders point of view, Drupal is always Drupal. By that I mean if you are familiar with one major version you should be able to learn the next major version fairly easily. The content creation procedure in Drupal 8 is similar to Drupal 7, the block system works the same way in Drupal 7 as it did in Drupal 6, Views works in a similar way, etc. There are subtle differences in the UI from one version to the next, but overall, if you know how to build a site with one version, you will be able to build a site with the subsequent version with no difficulty.
From a developers point of view things are not as straight forward. A new major version of Drupal comes out every 4 or 5 years, and with each new major version Drupal reinvents the wheel. Drupal 8, like each version of Drupal before it is a different beast than the system it is replacing. The theming system is different, the application programming interfaces (APIs) are different, and the codebase is different meaning every contributed modules that worked with one version of Drupal will not work with the next version until it is updated.
That means that all of the thousands of developers that have committed many hours to developing custom code, and contributed it to the community, must now rewrite their modules, sometimes starting over from scratch.
In some cases, features that were available for one version of Drupal may not be available when the next major version is released, and can take years to become available, if ever. The result is that a new major version of Drupal comes out that is more advanced, has better performance, and is more secure, but may also be missing features that make it less capable in some ways than the version it's replacing, and it can remain that way for years.
I believe that this, along with what I'm going to discuss below, is one of the reasons (there are others) Drupal continues to lag behind WordPress in popularity.
Drupal 8 and Composer
There was an additional issue with the release of Drupal 8 that many web designers and site builders, including myself, found difficult to wrap our heads around and that was the introduction of the Composer Dependency Manager.
Drupal is written in php. The Composer Dependency Manager, as its name suggests, is a dependency manager for php that ensures that any third party software libraries required by Drupal and any contributed modules are also installed. When Drupal and any contributed modules are updated, Composer ensures that any required third party libraries are updated as well.
With Drupal 8 the recommended installation and update process changed to accommodate this new requirement to use Composer. You can still install and update Drupal 8 the way you did with previous versions, through the web browser, but you will likely run into issues with updates not working properly with anything more than the most basic of sites. It is recommended that all Drupal 8 installations and updates be done using Composer.
Composer is a command line tool that has been used by php developers for a long time, it's just new to Drupal. So while the need to use Composer represents a new technology that needs to be learned, it also represents a big step forwards in Drupal becoming more standards compliant with the rest of the software development community.
The composer.json File
The composer.json file is where the site software configuration information is stored. I'm not going to get into the details of the composer.json file, just know that the file comes pre-configured when Drupal 8 is installed so you do not normally need to edit the file if you are following the recommended installation template.
When you use Composer to install modules and update your site, Composer writes the changes to the file and keeps it up to date so for the most part you do not need to be concerned with the contents.
That being said, you should be familiar with the composer.json file contents, and structure, because you will need to edit it from time to time to install patches, to make more advanced or complex/customized Drupal configurations, or if you run into issues with requirements for installing new modules, and updates, which does happen. You'll find the composer.json file in the root of your new Drupal 8 installation.
Learning to Use Composer with Drupal 8
When Drupal 8 was released there was a Composer Manager contributed module that has since been deprecated. There are many online tutorials and information on using Composer to install and manage Drupal and I found various explanations from different sources, all offering slightly different advice on the best way to proceed.
Even the official Drupal documentation had different instructions in different places with no clear definitive way to get up and running quickly.
Some other online sources included different composer commands to set up a new site but no real explanation as to why you would use one set-up over another, or what the long term ramifications might be.
Turns out that if you install your site with Composer using certain commands you will not be able to use Composer to update your site, even though updating the system using Composer is a requirement if you set your site up using Composer!
For a non-developer like me, the requirement to use Composer seemed like overkill for smaller sites. Composer can be complex at times, cause issues when updating Drupal, and when installing/updating contributed modules. However, it pays dividends to keep up with new technology, and to learn to use it.
Once you learn the basic commands Composer makes installing and updating a Drupal 8 site straightforward. There are occasionally issues with installations and updates not proceeding, requiring some troubleshooting, but using Composer to manage your site will ensure it stays properly updated and secure.
If you do run into issues, there are lots of online tutorials, forums, blog posts, etc to help you out - Google is definitely your friend here!
Contrib Modules and Theme Also Have a composer.json File
Contributed modules and themes also have their own composer.json file to tell Composer what other modules and libraries they depend on. As a site builder I do not need to be concerned about what libraries are required, the module/theme developers take care of that, but I do need to know how to use Composer when building a site so that the site is properly configured and contributed modules are installed (and uninstalled) properly.
Drupal 8 Recommended Template
After experimenting with Composer, a lot reading, and becoming familiar enough with how Composer worked, the configuration files, and the official Drupal documentation on Composer, I was able to overcome these challenges and install (and update) a Drupal 8 site with Composer without any issues (most of the time).
The difficulty, and confusion setting up Drupal 8 with Composer stems from the fragmented and confusing Drupal documentation. On top of that, to add to the confusion, the procedure has been updated a number of times since Drupal 8 was released.
Currently (May 2020) there is a Drupal Recommended Project template. To install a basic Drupal 8 site there is only one Composer command you need to know:
composer create-project drupal/recommended-project my_site_name_dir
I have that command stored in script file so all I need to do is run one script to download and install the latest version of Drupal 8 (there’s actually a little more to setting up a new Drupal 8 site, but the rest is no different than previous versions of Drupal and will be discussed in a later article).
Drupal 8 Going Forward
For the average site builder like myself, the requirement to use Composer seems like overkill. All I want to do is install Drupal 8 with a few contrib modules to get some relatively simple sites up and running. Composer is a command line tool. It's 2020! Why am I required to use the command line to set up a web site?
I can buy a self-driving car, order pizza through a speaker in my home, and have my fridge order milk automatically, but I still need to use a command line tool to set up a basic web site.
In the days when Wix and Squarespace are available at a very low price (or Free), there needs to be a compelling argument to go through the hoops required to set up and build a Drupal 8 web site.
For me that web site use case is usually the need for greater flexibility, meta-tag customization, on-page search engine optimization capability, and the power to display content in unique and interesting ways through things like Views, a very powerful feature in Drupal that enables you to display database content in an almost unlimited number of ways. Views is one of the main reasons Drupal is my first choice when it comes to open source content management systems.
The Drupal development team is well aware of these issues and is working hard to streamline and simplify the update and upgrade process. Despite the issues setting up and maintaining Drupal 8 sites, I intend to continue building new websites with Drupal 8. I like the power, flexibility, and security that Drupal provides and plan to continue using it for the foreseeable future.