Tutorials

Keeping your Drupal development tools up-to-date

Published December 29, 2022
Most folks in the community who are responsible for maintainting Drupal sites know that it’s important to keep them up-to-date with bug fix and (especially) security updates for both Drupal core and contributed modules. But what about the tools we use every day to build and maintain all those Drupal sites? As a general rule, I don't recommend updating things when you are near a task deadline, so as a new year begins, this might be a good time to take a look at your development tools and get things updated. This process can lead to improved performance, add new

The role(s) of services.yml files in Drupal

Published August 30, 2022
Most Drupal back-end developers, regardless of their skill level, have at least a passing knowledge of the role of services.yml files in Drupal development. While writing the curriculum for our upcoming, long-form Intermediate Module Development course, we realized that it only makes sense that we provide not only the purpose of a services.yml file when writing custom service classes, but also the role of both the sites/development.services.yml file and the sites/default/default.services.yml files. If you are already familiar with the process for creating a custom service class, then you know that the module_name .services.yml file serves to not only define the

Replacing Docker Desktop for Mac with Colima for use with DDEV - first impressions

Published May 23, 2022

Back in March, 2022, the DDEV team announced support for Colima , an open-source Docker Desktop replacement for Mac OS X. Based on the fact that Colima is open-source, Docker Desktop's new license terms, and the apparent performance gains of using Colima it seems like a no-brainer to give it a spin. First off, it's almost a drop-in replacement for Docker Desktop. I say almost for one reason, as any existing DDEV projects will need to have their databases reimported. In other words, if you have an existing project up-and-running in DDEV, then add Colima, then restart the project, your

DDEV + Pantheon Integration

Published May 13, 2022

Reposted with permission from Pantheon.io. ## Automating the Process of Keeping Your Local Environment Up-to-date DDEV is a Docker-based local development environment solution that allows developers to run local copies of all their Drupal and WordPress projects in a personal development environment. Much like similar Docker-based solutions, DDEV hides most of the complexity of Docker — allowing Drupal and WordPress developers to focus on what they like best. ## What Problem Are We Solving? One of the typical challenges that a developer faces when working on their local development environment is keeping their local database and content files up-to-date with

Understanding common cache-related HTTP response headers

Published January 26, 2021

Having a basic understanding of caching is a requirement of being a professional Drupal developer. Unfortunately, there can be many layers of caching which can make it challenging to figure out exactly how best to configure cache settings and troubleshoot potential caching issues. Web page caching can be thought of as moats around the castle, where each moat is a caching layer and the castle can be thought of as the site's web, database, and other origin servers. HTTP headers provide a mechanism for the client (usually a web browser) and a server (usually a web server) to exchange information

10 fieldable entity types every Drupal developer should know about

Published January 18, 2021
If you're a Drupal developer who designs information architecture (IA) for your organization and/or clients, then hopefully by now you're thinking in terms of entities, bundles, and fields, not limiting your thinking to only content types. This article isn't going to dive into a lesson explaining what entities, bundles, and fields are as there is plenty of great documentation about that . Back in the Drupal 7 and earlier days, it was common to look at an organization's data and map it almost exclusively to only content types (maybe a few vocabularies as well). With Drupal 8's and 9's Entity

Adding non-PHP dependencies to a Composer-based project

Published July 25, 2020
Over the past few years, the Drupal community has been (sometimes slowly) embracing the Composer dependency manager tool for PHP projects. We have become accustomed to adding Drupal modules and base themes to our projects using composer require but many of us have only scratched the surface of what more Composer can do for us. In this article, we'll go step-by-step in adding a non-PHP dependency to our project using Composer - as well as the helpful Composer installers extender plugin. We'll utilize Asset Packagist , a Composer repository for many popular NPM and Bower assets including things like Javascript

Composer 2.0-alpha2 performance comparison (speed and memory)

Published July 12, 2020
One of the primary goals of the upcoming Compose r 2.0 release is decreasing the memory footprint and increasing the performance of common commands. I decided to test out the performance of the second alpha release of Composer 2.0 to see how much real-world change users can expect to see. tl;dr: Composer 2.0 will be much faster and use much less memory. Users can expect to see up to a 2x gain in speed in composer create-project commands, up to a 10x gain in composer require commands, and a over a 2x gain in composer update commands. On the memory

entityQuery examples for everybody

Published July 11, 2020
This blog post was updated October, 2022 with new information about accessCheck, an example for loading fully populate node objects from entityQuery results, and the loadByProperties() method. The Drupal::entityQuery method has been a staple for Drupal developers since the early days of Drupal 8. But without a dedicated drupal.org Documentation page , it can be difficult for new developers to get a really good handle on. I've been using the QueryInterface API documentation for a few years now as my go-to source for help with using entityQuery, but a couple of weeks ago I stumbled on a feature of entityQuery

Import and map 800+ lighthouses in Drupal 9

Published June 28, 2020
Waaaaay back in 2013, I wrote a blog post about importing and mapping over 5,000 points of interest in 45 minutes using (mainly) the Feeds and Geofield modules. Before that, I had also done Drupal 6 demos of importing and displaying earthquake data. With the recent release of Drupal 9 , I figured it was time for a modern take on the idea - this time using the Drupal migration system as well as (still!) Geofield. This time, for the source data, I found a .csv file of 814 lighthouses in the United States that I downloaded from POI Factory

Composer Plugins for Drupal Developers

Published June 20, 2020
As always-evolving Drupal developers, we have been in the process of moving towards having a Composer -based workflow for managing our Drupal project codebases. While it is (normally) an easy jump from "drush dl" to "composer require" for Drupal contrib modules and themes, there's another significant opportunity for us to take advantage of during this evolution that should be considered. We are all familiar with the concept that Drupal modules extend the functionality of Drupal site; we should also be embracing the fact that there is a whole class of Composer dependencies that extend Composer's functionality. These are appropriately called

An effective method of using Config Split

Published June 7, 2020
If you use Drupal 8's configuration system, then you know that one of the trickiest parts of using it effectively is managing configuration on a per-environment basis. Luckily, the Config Split module makes it easy to manage different configurations in different environments, but how to set it up properly isn't always readily apparent. In this blog post, I'll provide one method for setting up Config Split in an efficient manner, with splits for local, remote development, and production environments. The goal is to be able to set things up right the first time, without having to worry about manually enabling/disabling

Demystifying drupal-core-require-dev and drupal-core-strict in the "Drupal Composer/Drupal Project" Composer template

Published July 12, 2019
If you build Drupal 8 sites using the Drupal Composer/Drupal Project Composer template (DCDP), then you've likely noticed the development dependency webflo/drupal-core-require-dev . If you're like me, you probably didn't give it much thought the first 20 or 30 times you used the template. After a while though, I started to dig deeper into the details of DCDP, wanting to be able to understand exactly how it worked and what customizations I may want to make. DCDP was really my first real exposure to Composer, and the more I learned, the more I wanted to learn (as is often the

Sharing your DDEV-Local site via a public URL using "ddev share" and ngrok

Published June 30, 2019
Version 1.9.0 of DDEV-local introduced the ability to share your local project online via a temporary, public URL using ngrok . This allows you the ability to quickly and securely provide access to your local site to other developers and stakeholders as well as an easy way to test your local site on other devices. ngrok is a service that exposes local servers behind NATs and firewalls via public URLs over secure tunnels. Once the small ngrok client is installed on your local machine, the ddev share command will enable the sharing and provide you with a public URL for

Some of my favorite (newer) DDEV things

Published May 27, 2019
Local development environments are in the midst a bit of a renaissance recently - mainly driven by the maturation and adoption of Docker-based solutions. I've been using (and recommending) DDEV for awhile now, and one of the things that I really like about it is the consistent pace of development. Since early February, there have been three minor releases of DDEV (1.6, 1.7, and 1.8) . With each minor release of DDEV comes new, often very useful features. Here's just a few of my recent favorites: NFS Mounting One of the few disadvantages of using a Docker-based solution over a