DDEV is an open source tool that makes it simple to get local PHP development environments up and running in minutes. Extend and share per-project environment configurations.
Windows using Chocolatey:
choco install ddev
Mac/Linux using Brew
brew tap drud/ddev && brew install ddev
Mac/Linux install script
curl -L https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash
Using DDEV in your project
Inside your PHP project's root directory, run
ddev config to setup the configuration of DDEV. Once complete, you can type
ddev start to run the containers inside of Docker. Initial setup and pulling of containers will take a minute or two, but once the containers are downloaded, starting and stopping DDEV will be a cinch.
Once complete, DDEV will give you two URLs, http://project.ddev.site and http://127.0.0.1:32769 to use for local development. If you wanted to share your project, you need to install ngrok and then you can run
For more information on using DDEV's CLI click here.
For a basic installation, that's it, you're all finished. However, if you need to extend DDEV, you have complete freedom. For instance, you can go to /.ddev/config.yaml and change or add configuration parameters. Here's my config file as an example...
APIVersion: v1.13.1 name: blog type: php docroot: public php_version: "7.4" webserver_type: nginx-fpm router_http_port: "80" router_https_port: "443" xdebug_enabled: true additional_hostnames:  additional_fqdns:  nfs_mount_enabled: false provider: default use_dns_when_possible: true timezone: ""
You can also add your own custom commands. For instance, if you have a Laravel project you can create a file called artisan inside the /.ddev/commands/web directory. Within this file add the following
#!/bin/bash php artisan $@
This will allow you to run any artisan command such as
ddev artisan make:migration create_comments_table and it will generate a new migration file.
For testing, I added a file named phpunit with
This allows me to run
ddev phpunit and it will run my testing suite. The same can be done for Symfony's console command. Create a file called console inside the same web directory as before and add the following.
#!/bin/bash php bin/console $@
And now you can run any Symfony console command using
ddev console debug:router etc. If you would like to read more on this, then please take a look at their custom commands documentation.
I've covered the basics of using DDEV, but there is a lot more that it can do. You can switch from nginx to apache, change PHP versions and even add services such as Memcached, Solr, Beanstalk and more.
I'll make another blog post in the future which goes into more details about these other services, but in the meantime you can sign up to my newsletter using the form below.