Local Drupal Development environment

Alt Cover text

Local Drupal Development environment

A local development environment helps developers test and build websites on a local machine without an Internet connection. The idea is to avoid doing changes directly in the production environment to avoid breaking something on the public website.

According to the Drupal official documentation At least, you need a web server (Apache or Nginx), a database server (MySQL, MariaDB, or PostgreSQL), and PHP.

So we have a lot of options for setting up a local environment. In this post, we are going to cover some of them. For example: 

You can use just plain Docker or install manually all the required native programs in the particular OS (Linux, macOS, or Windows), but the initial setup could take extra time; also you have to maintain the future changes and support this configuration, which means you might spend more time just to keeping it working.

We recommend using packages preconfigured like DDEV, Lando, or Docksal if you are working on a “real” project because you can take advantage of these tools to:

  • Standardize the website environment across the different local environments according to the server specifications (Dev, Staged, and Production), 
  • Use the command line interface
  • And faster initial setup for new incoming developers. At Dailysoft we prefer Lando due to its flexibility. 

About packages apps like XAMPP (a completely open-source package Apache distribution containing MariaDB, PHP, and Perl.) it is compatible with Linux, macOS, and Windows or MAMP (a commercial frontend for the classic local server environment) compatible with macOS and Windows only. Because those tools don't have the flexibility that Docker-based has, we don’t recommend working with them on client projects. Besides if you want to easily have a lot of websites locally you have to buy the Pro version of MAMP and if there is a coworker that uses Linux, eventually the issue related to different versions of environments is going to appear. 

I had the opportunity to work on a virtual machine environment like Vagrant, the use of this tool was very common for Drupal 7 local environments but due to a virtual machine consuming more resources than Docker, the development companies have been migrating the Vagrant environment to Docker. We recommend you learn more about it because there are some websites that are using this tool for local setups but for new developments, in my opinion, the best option is Docker.

As developers, we have to choose one option to set up our local environment, this decision usually is based on the project type, client requirements, etc. But if you are free to take one, is good to know which of those is going to save you time in pro of the project deadline. We hope this post could help you.

Image of Freepik