DDEV — Local PHP Development Environments with Docker
Practical guide to DDEV — a container-based local development environment for PHP projects like Drupal, TYPO3 and WordPress, driven by a single CLI.
DDEV is a container-based local development environment that wraps your web server, database and PHP into Docker (or Podman) containers, all driven through a single, consistent CLI. Instead of installing each component by hand, you describe your project in one configuration file and spin up the whole stack with a single command. It has become a de-facto standard in the PHP and CMS world – Drupal, TYPO3, WordPress, Contao and Shopware among them. This guide walks you through the commands you reach for daily, from creating a project to database import and export, Xdebug and add-ons.
Project Setup & Configuration
ddev config — Interactively configure a new or existing DDEV project in the current directory. Creates or updates .ddev/config.yaml.
ddev configddev config --project-name <name> — Set the project name (used for the hostname:
ddev config --project-name myshopddev config --project-type <type> — Set the project type. Options: php, wordpress, drupal, drupal6, drupal7, drupal10, drupal11, typo3, magento, magento2, laravel, craftcms, django4, python, and more.
ddev config --project-type wordpressddev config --php-version <version> — Set the PHP version for the project. Supported: 5.6, 7.0 – 7.4, 8.0 – 8.4.
ddev config --php-version 8.3ddev config --webserver-type <type> — Set the web server type: nginx-fpm (default), apache-fpm, or nginx-gunicorn.
ddev config --webserver-type apache-fpmddev config --docroot <path> — Set the document root relative to the project directory.
ddev config --docroot webddev config --database <type>:<version> — Set the database type and version. Options: mysql:5.7, mysql:8.0, mariadb:10.6, mariadb:10.11, postgres:14, etc.
ddev config --database mariadb:10.11ddev config --additional-hostnames <names> — Add extra hostnames (comma-separated) that resolve to the project.
ddev config --additional-hostnames api.myshop,cdn.myshopddev config --timezone <tz> — Set the container timezone.
ddev config --timezone Europe/BerlinProject Lifecycle
ddev start — Start the DDEV project in the current directory. Pulls Docker images if needed.
ddev startddev stop — Stop the DDEV project containers without removing them.
ddev stopddev stop --all — Stop all running DDEV projects on the machine.
ddev stop --allddev restart — Stop and start the DDEV project. Applies config changes.
ddev restartddev pause — Pause the project containers to free CPU/memory without losing state.
ddev pauseddev poweroff — Stop all DDEV projects and the global router. Use before shutting down.
ddev poweroffddev delete — Remove the DDEV project (containers, volumes). Does NOT delete project files.
ddev deleteddev delete --omit-snapshot — Delete the project without creating a database snapshot first.
ddev delete --omit-snapshotddev delete images — Remove all unused DDEV Docker images to free disk space.
ddev delete imagesStatus & Information
ddev describe — Show detailed status, URLs, database info, and service details for the current project.
ddev describeddev list — List all DDEV projects on the machine with their status.
ddev listddev list --active-only — List only currently running DDEV projects.
ddev list --active-onlyddev version — Show the DDEV version and system information.
ddev versionddev launch — Open the project URL in the default browser.
ddev launchddev launch /path — Open a specific path on the project URL in the browser.
ddev launch /wp-adminddev status — Show the status of the current project's containers.
ddev statusShell & Command Execution
ddev ssh — SSH into the web container of the current project as the www-data user.
ddev sshddev ssh -s db — SSH into the database container.
ddev ssh -s dbddev exec <command> — Execute a command inside the web container.
ddev exec ls -la /var/www/htmlddev exec -s db <command> — Execute a command inside the database container.
ddev exec -s db mysql -u root -proot mydbddev exec --raw <command> — Execute a command without the default environment setup (raw Docker exec).
ddev exec --raw cat /etc/os-releaseddev . <command> — Shorthand for ddev exec. Run a command in the web container.
ddev . php -vDatabase
ddev mysql — Open an interactive MySQL/MariaDB shell connected to the project database.
ddev mysqlddev mysql -e "<query>" — Execute a SQL query directly from the shell.
ddev mysql -e "SHOW TABLES;"ddev import-db --file=<file> — Import a database dump (.sql, .sql.gz, .sql.bz2, .tar, .zip) into the project database.
ddev import-db --file=dump.sql.gzddev import-db --database=<name> --file=<file> — Import a dump into a specific named database.
ddev import-db --database=staging --file=staging.sqlddev export-db --file=<file> — Export the project database to a compressed SQL file.
ddev export-db --file=backup.sql.gzddev export-db --gzip=false --file=<file> — Export the database as a plain (uncompressed) SQL file.
ddev export-db --gzip=false --file=backup.sqlddev export-db | gzip > backup.sql.gz — Export the database to stdout and pipe it to gzip.
ddev export-db | gzip > backup.sql.gzddev tableplus — Open the database in TablePlus GUI (if installed).
ddev tableplusSnapshots
ddev snapshot — Create a snapshot of the current database state. Can be restored later.
ddev snapshotddev snapshot --name <name> — Create a named database snapshot for easy identification.
ddev snapshot --name before-migrationddev snapshot restore — Restore the most recent database snapshot.
ddev snapshot restoreddev snapshot restore <name> — Restore a specific named snapshot.
ddev snapshot restore before-migrationddev snapshot restore --latest — Restore the latest snapshot without prompting.
ddev snapshot restore --latestddev snapshot list — List all available snapshots for the current project.
ddev snapshot listddev snapshot delete <name> — Delete a specific named snapshot.
ddev snapshot delete before-migrationddev snapshot delete --all — Delete all snapshots for the current project.
ddev snapshot delete --allComposer, PHP & Node
ddev composer <args> — Run Composer inside the web container with the correct PHP version.
ddev composer installddev composer require <package> — Require a Composer package inside the container.
ddev composer require monolog/monologddev composer update — Update all Composer dependencies inside the container.
ddev composer updateddev php <args> — Run PHP CLI inside the web container.
ddev php -vddev php artisan <command> — Run a Laravel Artisan command inside the container.
ddev php artisan migrateddev npm <args> — Run npm inside the web container.
ddev npm installddev npm run <script> — Run an npm script inside the container.
ddev npm run buildddev node <args> — Run Node.js inside the web container.
ddev node --versionddev yarn <args> — Run Yarn inside the web container (if Yarn is installed).
ddev yarn installLogs
ddev logs — Show the web container logs (stdout/stderr from nginx/apache + PHP).
ddev logsddev logs -f — Follow (tail) the web container logs in real-time.
ddev logs -fddev logs -s db — Show logs from the database container.
ddev logs -s dbddev logs -s db -f — Follow the database container logs in real-time.
ddev logs -s db -fddev logs --tail <n> — Show only the last N lines of container logs.
ddev logs --tail 100Add-ons & Services
ddev add-on get <addon> — Install a DDEV add-on (formerly 'ddev get'). Add-ons provide extra services like Redis, Solr, Memcached, Mailpit, etc.
ddev add-on get ddev/ddev-redisddev add-on list --all — List all available official DDEV add-ons from the registry.
ddev add-on list --allddev add-on list — List add-ons currently installed in the project.
ddev add-on listddev add-on remove <addon> — Remove an installed add-on from the project.
ddev add-on remove ddev-redisddev add-on get ddev/ddev-mailpit — Install Mailpit for local email testing (replaces Mailhog).
ddev add-on get ddev/ddev-mailpitddev add-on get ddev/ddev-phpmyadmin — Install phpMyAdmin for database management.
ddev add-on get ddev/ddev-phpmyadminddev add-on get ddev/ddev-adminer — Install Adminer as a lightweight database management UI.
ddev add-on get ddev/ddev-adminerFile Management
ddev import-files --source=<path> — Import files (tar.gz archive or directory) into the project's upload/files directory.
ddev import-files --source=files.tar.gzddev export-files --destination=<path> — Export the project's upload/files directory to a tar.gz archive.
ddev export-files --destination=files-backup.tar.gzddev exec scp <remote>:<path> <local> — Copy files from a remote server into the container using SCP via SSH agent forwarding.
ddev exec scp user@prod:/var/www/html/files ./filesGlobal Configuration
ddev config global — Show and edit global DDEV configuration (applies to all projects).
ddev config globalddev config global --instrumentation-opt-in=false — Opt out of anonymous usage statistics collection.
ddev config global --instrumentation-opt-in=falseddev config global --use-hardened-images=true — Use hardened (security-focused) Docker images globally.
ddev config global --use-hardened-images=trueddev config global --router-bind-all-interfaces=true — Bind the DDEV router to all network interfaces (for LAN access from other devices).
ddev config global --router-bind-all-interfaces=trueddev config global --performance-mode=mutagen — Enable Mutagen file sync for significantly faster file performance on macOS/Windows.
ddev config global --performance-mode=mutagenddev config global --simple-formatting=true — Disable colorized/boxed table output for simpler terminal logging.
ddev config global --simple-formatting=trueddev hostname --list — List all hostnames currently managed by DDEV in /etc/hosts.
ddev hostname --listSSL & HTTPS
mkcert -install — Install the mkcert root CA. Run once after installing mkcert. Required for trusted HTTPS in DDEV.
mkcert -installddev config --use-dns-when-possible=true — Use DNS for hostname resolution instead of /etc/hosts (requires internet access).
ddev config --use-dns-when-possible=trueddev exec curl -sI https://localhost — Test the HTTPS connection inside the container.
ddev exec curl -sI https://localhostddev debug router-nginx-config — Show the generated nginx router configuration for debugging HTTPS/routing issues.
ddev debug router-nginx-configDebugging & Profiling
ddev xdebug on — Enable Xdebug inside the web container for step debugging.
ddev xdebug onddev xdebug off — Disable Xdebug (re-enables when container restarts, unless set in config).
ddev xdebug offddev xdebug status — Show whether Xdebug is currently enabled or disabled.
ddev xdebug statusddev config --xdebug-enabled=true — Permanently enable Xdebug for this project (persists across restarts).
ddev config --xdebug-enabled=trueddev xhprof on — Enable xhprof PHP profiler. Access the profiler UI via the DDEV URL.
ddev xhprof onddev xhprof off — Disable the xhprof profiler.
ddev xhprof offddev debug nfsmount — Test whether NFS is working correctly (macOS NFS performance mode).
ddev debug nfsmountddev debug test — Run a series of self-tests to check DDEV's configuration and environment.
ddev debug testCustom Commands & Hooks
ddev <custom-command> — Run a custom command defined in .ddev/commands/web/ or .ddev/commands/host/.
ddev deployddev artisan <command> — Run Laravel Artisan via a custom DDEV command (if configured as add-on).
ddev artisan migrate:fresh --seedddev craft <command> — Run Craft CMS CLI commands inside the container.
ddev craft migrate/allddev drush <command> — Run Drush (Drupal CLI) inside the container.
ddev drush crddev wp <command> — Run WP-CLI commands inside the container (if WordPress project type).
ddev wp plugin listddev typo3 <command> — Run TYPO3 Console commands inside the container.
ddev typo3 cache:flushCleanup & Maintenance
ddev clean — Remove temporary Docker images and containers not associated with any project.
ddev cleanddev clean --all — Remove all DDEV Docker images, containers, and networks. Full cleanup.
ddev clean --allddev self-upgrade — Upgrade DDEV to the latest version (if installed via the self-upgrade method).
ddev self-upgradeddev pull <provider> — Pull database and/or files from a configured remote provider (e.g. Pantheon, Acquia, Platform.sh).
ddev pull pantheonddev push <provider> — Push database and/or files to a configured remote provider.
ddev push acquiaddev mutagen reset — Reset the Mutagen sync session (macOS/Windows performance mode). Use if sync gets out of sync.
ddev mutagen resetddev mutagen monitor — Monitor the Mutagen sync status in real-time.
ddev mutagen monitor Conclusion
DDEV takes the tedium out of setting up local development environments: one ddev config, one ddev start, and your web server, database and PHP run reproducibly in containers. Because the entire configuration lives inside the project under .ddev/, your whole team works with identical versions and new contributors are up and running in minutes. As you go deeper, add-ons, Mutagen sync and custom commands combine into a workflow that meaningfully narrows the gap between your local machine and production.
Further Reading
- DDEV – official website – overview, downloads and blog
- DDEV documentation – full reference and guides
- DDEV on GitHub – source code, releases and issue tracker
Related Commands
- docker – the container engine DDEV builds on
- docker-compose – define multi-container setups declaratively
- helm – package manager for Kubernetes deployments