DEV Community

Cover image for Setting Up a Drupal Development Environment with DDEV
Sarah Siqueira
Sarah Siqueira

Posted on

Setting Up a Drupal Development Environment with DDEV

DDEV is a powerful tool that simplifies the process of setting up local development environments for PHP applications, including Drupal. In this guide, I'll walk you through the steps to install DDEV and configure a Drupal development environment.

Requirements:

Once you have this, create your Drupal project directory:

mkdir drupal-site

Into your directory run:

composer create-project drupal/recommended-project:^9 .

At the moment I created this project, running composer create-project drupal/recommended-project . automatically would download Drupal 10, which requires PHP version ">= 8.3.0". This would trigger a fatal error:

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.3.0". You are running 8.1.27. in /var/www/html/vendor/composer/platform_check.php on line 24
because the DDEV container has an older PHP version. That’s why I explicitly asked for Drupal 9 in the command.

Next, configure DDEV:

ddev config

You will be prompted with some options. Select your project name, docroot location, and then the project type. You’ll see options like:

Project Type [backdrop, craftcms, django4, drupal10, drupal6, drupal7, drupal8, drupal9, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress]

In this case, I selected drupal9. After that, run:

ddev start

You will see a success message with the URLs to access your Drupal project: Project can be reached at https://drupal-site.ddev.site https://127.0.0.1:52810

Open your chosen browser and finish the Drupal installation.

Simple as that!

DDEV can be used for a wide variety of PHP-based CMSs, such as WordPress. You can follow a similar process; check out this article: Setting up a WordPress development environment with DDEV.

What is your favorite tool for local PHP development? From my experience with a wide variety of setups over the years, DDEV has proven to be an amazing solution for teams. It simplifies versioning, collaboration, and later establishing deployment pipelines, making development smoother and more predictable.

Leave your comment below. I’d love to hear your thoughts!

Image: https://www.valuebound.com/resources/blog/how-use-ddev-streamline-your-drupal-development-process

Top comments (1)

Collapse
 
_2_186ea322163f profile image
سليل قحطان 2

مرحبا كيف حالك