Modern PHP development with DDEV.

Bartlomiej Witkowski
3 min readMay 6, 2024

--

Forget about MAMP and XAMP.

Photo by Ben Griffiths on Unsplash

There’s no magic bullet when it comes to picking an operating system for development. Each one has its pros and cons. I’ve been using Ubuntu to build web apps with the LEMP stack (that’s fancy talk for Linux, Nginx, MySQL, and PHP). It’s been working well for me, but there are definitely other options out there!

A lot of people is installing PHP, MySQL or Node locally on their hosts machines, while it’s working and it’s easy for beginners — it’s definitely not best solution. What if we need to change PHP version on the one of our projects or install project specific PHP packages which conflicts with others?

PHP development on Ubuntu

I love work on Ubuntu, but there are some challenges. One of them is design collaboration. Our agency uses Adobe XD, which is not available for Ubuntu, so I’ve been running Windows in VirtualBox. It works, but let’s be honest, it’s not the most elegant solution.

PHP development environment on macOS

I have been wondering a lot for change to Apple one operating system. It’s also Unix and offers ZSH which is very close to BASH. It has also a much better support for many other desktop apps than Ubuntu.

PHP development environment Windows and WSL2

I’m actually not a big fan of Windows, but honestly, Windows 11 and WSL2 are a game changer.

WSL2 stands for Windows Subsystem for Linux. It allows you to run Ubuntu (or other Linux distributions) directly on your Windows machine without needing a dual boot setup or a clunky VirtualBox window. It’s like having two operating systems in one, seamlessly integrated. You can even access your Windows files from the Bash terminal and vice versa.

You can read how to install WSL2 here.

What is DDEV?

This is a tool that helps set up a development environment in minutes. Under the hood, it uses Docker to build containers with all the dependencies you need for development. This means you don’t need to install anything directly on your host machine. It has great support for the most popular PHP frameworks and can also work with your custom projects.

I learned Docker myself and even created a local development tool, but it was time-consuming. Once I tried DDEV, I simply switched to using it. It truly solves a lot of common tasks, like setting up SSL on your local machine.

Check out this guide to get started: https://ddev.readthedocs.io/en/stable/

How to use it?

Once you have DDEV ready on your machine, you can just navigate to your project and write following:

ddev config

Then you need to write some configuration details, project name, web root folder and project type. Then just start with:

ddev start

Voila! You can reach your project in https://myproject.com.ddev.site

Deep dive

If you need to customize your environment you can easy edit NGINX config

You can change the PHP version, database engine, Composer, or NPM version in the config.yaml file. This provides a lot of flexibility and removes the risk of conflicts with other packages because all files are contained within Docker containers.

Thanks for reading!

--

--

Bartlomiej Witkowski

I am a developer who loves challenges and resolving complex problems. I'm interested in many IT fields, such as backend, frontend, and cybersecurity.