On this page
- Recommended development options in order of complexity
- 1. Drupal Testing site or Online Preview
- Simplytest.me: Use as Online Testing Environment (With or Without Patches)
- Step-by-Step Instructions
- Tugboat: Test Merge Requests with Automatic Preview
- 2. Cloud based development environment
- DrupalPod via Drupal Forge
- DDev in the Cloud
- 3. Local development environment
- Option 1. Use DDEV for local development
- Drupal Core
- Contrib modules
- Option 2. If you already have a local development environment
- Testing a patch
- Other ways to set up a development environment
- Other Useful Tools
- Drush
Contributor development and testing tools
This documentation needs review. See "Help improve this page" in the sidebar.
Shorter URL to this page: drupal.org/tools
Pro Tip: Combine Multiple Options
You don’t have to choose just one! Develop patches in your local environment and, when you’re ready to share, spin up a testing site to showcase your work to others.
Simplytest.me: Use as Online Testing Environment (With or Without Patches)
Simplytest.me is a free online tool that allows you to create temporary environments for testing Drupal core and contributed projects, such as modules, themes, and distributions. You can test specific released versions (e.g., 11.0.1, 2.0.1), development versions (e.g., 11.2.x, 8.x-2.x), or even apply patches from Drupal issues to test custom configurations. Below is a step-by-step guide to using it effectively.
Note (Dec. 2024): The "One Click Demos" feature has been unreliable recently, so it’s recommended to follow the manual steps outlined here for consistent result
Step-by-Step Instructions
- Visit the Site:
- Go to Simplytest.me to start.
- Select Your Project:
- In the Project field:
- For a contributed project (e.g., a module or theme), type its name.
- For Drupal core, simply enter "Drupal core."
- In the Project field:
- Choose a Version:
- Pick the version you want to test:
- Released versions (e.g., 11.0.1, 2.0.1) appear at the top of the list.
- Development versions (e.g., 11.2.x, 8.x-2.x) are listed toward the bottom.
- Pick the version you want to test:
- Add Additional Modules or Themes (Optional):
- Expand the "Advanced" section.
- Click the Add additional project button and type the project name. Repeat as desired.
- Simplytest.me will automatically select versions compatible with your chosen project and version.
- Apply Patches (Optional):
- Expand the "Advanced" section.
- Paste the full URL(s) to any Drupal patch(es) you want to apply.
- Requirements:
- Patches must be from the primary project (e.g., Drupal core or the selected contributed project).
- They must be patch files uploaded to a drupal.org issue (e.g., https://www.drupal.org/files/issues/[patch-name].patch).
- Launch the Site:
- Click the button to create your test site and wait for it to build.
- Once ready, you can access it and log in as the "user 1" administrator:
- Username: admin
- Password: admin
- Site Email: admin@example.com
Tugboat: Test Merge Requests with Automatic Preview
For Drupal Core issues (and some contributed project issues) that use merge requests, an automatic test site can often be generated using Tugboat. It requires registration, or logging in via another account.
Here’s how it works:
- Accessing the preview:
- If a merge request has an automatic preview available, you’ll see a View live preview link under the merge request section of the issue.
- Click the View live preview link to launch the test site.
- Login details:
- Log in as the "user 1" administrator with these credentials:
- Username: admin
- Password: admin
- The site email address is: admin@example.com
- Log in as the "user 1" administrator with these credentials:
- Additional resources:
- For a detailed guide, check out Using live previews on Drupal Core merge requests.
2. Cloud based development environment
DrupalPod via Drupal Forge
This project allows you to work on Drupal core contributions with a familiar setup of a "normal" Drupal website. This option does not require any changes to your personal or work-provided computer because it is all running in the cloud.
Start Drupal contributions with 1 click using Drupal Forge. Follow the instructions on DrupalPod + Drupal Forge page including a Demo Video of Drupal Forge.
Project URL: https://drupal.org/project/DrupalPod
DDev in the Cloud
This project allows you to work on Drupal core contributions with the recommended ddev environment. This option does not require any changes to your personal or work-provided computer because it is all running in the cloud.
Follow the instructions on the DDev in the Cloud page to get started.
Project URL: https://github.com/ddev/coder-ddev
3. Local development environment
Option 1. Use DDEV for local development
The recommended Drupal local development environment for Linux, macOS, and Windows is DDEV.
Follow the instructions to install Drupal using DDEV for local development.
Drupal Core
The fastest method is by applying the patch. If you want to work on the MR locally, you can check out the issue branch with Git.
Applying the MR patch
Download the patch and apply it:
wget https://git.drupalcode.org/project/drupal/-/merge_requests/8251.diff
patch -p1 < 8251.diffGit - check out the Issue Repo
To use Git to test a Merge Request for an existing Issue on Drupal Core, with further work in mind, you can add the MR URL as a remote. From the MR page click the blue Code button and select "Check out branch". The modal will give you the URL in the git fetch line. Looking at this MR the following would set us up.
# Add the MRs URL as the remote.
git remote add mr-8251 git@git.drupal.org:issue/drupal-3418353.git
# Fetch the remote
git fetch mr-8251
# Create a local branch
git branch 3418353-restrict-rebuild-permission mr-8251/3418353-restrict-rebuild-permission
# Switch to that local branch
git checkout 3418353-restrict-rebuild-permissionContrib modules
There are multiple approaches for working on contrib modules. These are the most common.
Adding via Composer
To test the patch of a Merge Request you can add the module as you would during normal site building and patch it.
Looking at this MR for Admin Toolbar this would set us up.
ddev composer require drupal/admin_toolbar:3.x-dev@dev
cd web/modules/contrib/admin_toolbar/
wget https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/142.diff
patch -p1 < 142.diffChecking out the Issue Repo
To work on a Merge Request for an existing Issue on a contrib module you could clone the URL for the MR directly into the modules directory, fetch the branch and check it out.
Looking at this MR for Workbench Email this would set us up.
cd modules
git clone git@git.drupal.org:issue/workbench_email-3515843.git workbench_email
cd workbench_email/
git fetch "git@git.drupal.org:issue/workbench_email-3515843.git" '3515843-error-when-trash'
git checkout 3515843-error-when-trashAt this point you can enable the module as normal.
If you are just wanting to test a patch rather than work on an MR see Applying a patch in a feature branch.
Option 2. If you already have a local development environment
If you already have a web server, PHP, and database installed on your local computer that satisfy the requirements for the latest development of Drupal, know how to install Drupal, and know where your web root is, follow these steps to create a new Drupal site for testing a patch:
- Make sure you have both Composer and Git installed on your computer.
- Set up Git for use in the Drupal project.
- Follow the steps on the Version control instructions page for the Drupal core project to clone Drupal into a new directory under your web root. Change to that directory.
- From the Drupal root directory, run the following command to download the external dependencies for the Drupal core software:
composer install - Set up a database for your Drupal site, and install Drupal.
Testing a patch
- Rename the example.gitignore file to .gitignore, so that you don't accidentally commit your locally installed packages.
- Use the
git applycommand to apply the patch you want to test.
Other ways to set up a development environment
There are many options for setting up development environments. Although we recommend the above methods, you may find the local server setup documentation section and developer tools section useful to browse.
Other Useful Tools
Drush
1. Install Drush:
- Use Composer to install Drush for your current project. Run the command:
composer require drush/drush
- Ensure the Composer vendor binary directory is in your system's PATH. You can add this to your shell configuration file (e.g.,
.bashrc,.zshrc):
export PATH=$HOME/.composer/vendor/bin:$PATH
2. Verify Installation:
- After installation, confirm Drush is working by running
drush --version
3. Utilize Drush Commands:
- Enable Modules:
drush en <module machine name> - Clear Cache:
drush cr - Database Updates:
drush updb
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion