Upgrading is the process of moving your site from a previous major version of Drupal to a newer version, for example from Drupal 7 to Drupal 11.
Contributing to Drupal
TopicAs an open source project, Drupal depends on community contributions in many forms including documentation, code, translation, speaking, organizing events, mentoring others, and even donating money.
Back up Your Drupal Site
TopicA reliable backup will allow you to restore your site if something goes wrong.
Composer for Drupal Users
CourseDrush
TopicDrush is a command line interface that enables you to interact with your Drupal site without clicking around the graphical user interface (GUI).
Every Composer project is made up of a few standard files and directories. This tutorial provides an overview of the anatomy of a Composer project, and the essential files and directories used by Composer, including:
- What are composer.json and composer.lock files?
- What is in a composer.json file?
- What is the /vendor directory?
By the end of this tutorial you should be able to recognize the standard files and directories in a Composer project and know what they are each used for.
This tutorial demonstrates the value of using Composer. This demonstration will employ the most basic use case of using Composer to create a new, non-Drupal application that writes a message to the system log. It will encompass the fundamental concepts of Composer installation, requiring (installing) a new dependency, autoloading it, and implementing it.
In this tutorial we'll:
- Install Composer
- Use Composer to start a new project
- Use Composer to require a 3rd party dependency
- Use the required code in an example application
By the end of this tutorial you should be able to explain the value of Composer, and have Composer installed and working on your local machine.
This tutorial provides an overview of the concept of an "artifact" and provides step-by-step instructions for deploying a Composer-managed Drupal application to a hosting environment.
In this tutorial we'll:
- Define what an "artifact" is
- Look at how to use Composer and a build process to create and deploy an artifact
- Talk about the benefits of this approach
By the end of this tutorial you should have a general understanding of the steps required in order to deploy a Composer-managed project into production.
You will inevitably encounter Composer issues that require troubleshooting. This tutorial aims to provide some general troubleshooting advice for common Composer issues.
In this tutorial we'll look at:
- Common issues you'll encounter when using Composer
- Solutions to these common issues
By the end of this tutorial you should have some ideas of how to solve common issues that you might encounter when using Composer to manager your application's dependencies.
Composer packages use semantic versioning to allow you to differentiate among different releases of a project. Knowing how this works, and how to specify a version constraint when requiring a Composer package are an important part of using Composer.
In this tutorial we'll:
- Get an overview of semantic versioning
- Look at how Composer version constraints work and related best practices
- Learn how to define Composer package requirements such that you can quickly update all of your application's dependencies without breaking existing functionality
By the end of this tutorial, you should understand how semantic versioning relates to Composer, and how to specify version constraints for packages in your Composer project.
What Is Composer?
FreeComposer is the preferred dependency management solution for PHP. List your project's dependencies in a composer.json file and, after issuing a few commands in the CLI, Composer will automatically download your project's dependencies and set up autoloading for you. Composer is analogous to NPM in the Node.js world, or Bundler in the Ruby world.
Drupal core uses Composer to manage non-Drupal dependencies like Guzzle and PHPUnit. An increasing number of contributed modules also use Composer to integrate third party PHP libraries into Drupal.
This series provides guidance for Drupal developers and site builders who would like to learn to use Composer to build and maintain a Drupal application.
It covers high-level concepts about Composer and walks you step-by-step through creating a new application, downloading PHP libraries, and implementing them using Composer!
It also covers Drupal-specific Composer configuration and provides guidance for accomplishing common Drupal tasks like updating core and installing a new module.
In this tutorial we'll:
- Familiarize ourselves with the general concepts of dependency management
- Learn about Composer and the role it plays in a PHP/Drupal project
- Learn about some advantages and disadvantages of using Composer
By the end of this tutorial you should be able to explain what Composer is, what it's used for, and make the case for using it in your own projects.
There's been a lot written about API design, it's probably not surprising there are several books written about the subject. It also seems like nearly every cloud-based service provides an API to allow access to your data. In this tutorial, we'll attempt to condense this information and answer the following questions:
- Are there different types of API paradigms?
- What kinds of considerations do we need to make when building an API for our decoupled site?
- And, what's this REST thing everyone is talking about?
Let's dig into those questions one at a time.
Decoupling Explained
FreeIf you're interested in decoupling Drupal, there's a good chance you've heard at least some of the buzz in the Drupalverse about "headless" or decoupled Drupal. Or perhaps you watched Dries' keynote from DrupalCon Barcelona or read Dries' blog post about the future of decoupled Drupal. Whatever the case may be, this tutorial and the ones that follow will walk you through building a simple decoupled blog. In Dries' terminology the demo site we'll be building is "fully decoupled." While it would be trivial to adopt similar techniques to build a progressively decoupled site, let's dig a bit deeper into what it means to build a decoupled Drupal site.
Andrew Berry, from Lullabot, has written a great article asking Should you Decouple? Like most architectural decisions there are trade-offs to consider with a decoupled approach. Let's take a look at some of the pros and cons of a decoupled approach. Is it the right choice for your project?
At this point, whether we've decided to use a third-party pre-rendering service or we've written our own isomorphic JavaScript application to serve as the front-end of our website, our hosting requirements have definitely gotten more complex. Let's take a look at the continuum of decoupled site architectures and start to come up with a list of things to keep in mind when considering their hosting requirements.
Drush is the command line shell and Unix scripting interface for Drupal. The most common way to install Drush is to install it on a per-project basis using Composer. We'll walk through the steps to do that, as well as how to set up the Drush Launcher tool (to make it possible to execute Drush commands without having to specify a full path to the executable).
In this tutorial we'll:
- Install Drush
- Verify it worked
By the end of this tutorial you'll have Drush installed.
Configure basic settings which affect performance, and perform basic analysis to understand what might be affecting website performance.
Every Drupal module needs a *.info.yml file; the basic structure of a form controller class and related routing is the same for every form; and much of the code required to create a custom content entity type is boilerplate annotations and extending base classes. Wouldn't it be nice if there was a way to automate some of that repetitive work? Drush can be used to speed up module development by generating scaffolding code for event subscribers, forms, services, module files, routing, and much more. These generators are provided by the Drupal Code Generator project. They're neatly bundled up in Drush under the drush generate
command.
Before Drush 9, there were no code generators in Drush, but the Drupal Console project provided them. That project and its code generators, have languished since the release of Drupal 9. While it can still be used, and is often referenced in tutorials about Drupal, we much prefer the code generated by Drush at this point.
In this tutorial we'll:
- Learn about the Drupal Code Generator project
- Learn how Drush integrates with this project
- Demonstrate the
drush generate
command and its options
By the end of this tutorial, you'll know how to use the drush generate
command to speed up development for your Drupal modules.
A multisite Drupal installation allows you to host multiple, separate websites while relying on the same set of code. Large organizations often rely on a multisite installation to cut down on the operational upkeep of multiple sites. Hosting a multisite in Docker poses several additional challenges. Fortunately, the process is not dissimilar from configuring a bare-metal server to run a multisite.
In this tutorial, we'll:
- Outline a multisite's additional requirements for Docker containers.
- Configure alternate, local domain names to resolve each site.
- Learn how to configure a multisite to use alternate domain names.
Installing Drupal using the instructions in this tutorial will give you a working Drupal site that can be used for learning, or real-world project development.
Before you can work on a Drupal site locally (on your computer), you'll need to set up a local development environment. This includes all the system requirements like PHP and a web server, that Drupal needs in order to run. Our favorite way to accomplish this is using DDEV.
In this tutorial we'll learn:
- How to install and configure DDEV for use with a Drupal project.
- How to use DDEV's integrated Composer to download Drupal and Drush.
- How to install Drupal inside DDEV so you can access the site and start doing development.
By the end of this tutorial, you should be able to set up a local development environment for learning Drupal or working on a new Drupal project.