| name | drupal-ddev |
| description | DDEV local development environment patterns for Drupal, including configuration, commands, database management, debugging tools, and performance optimization. |
DDEV for Drupal Development
Comprehensive patterns for using DDEV as your local Drupal development environment, including setup, configuration, workflow optimization, and troubleshooting.
When This Skill Activates
Activates when working with DDEV local development including:
- DDEV configuration (.ddev/config.yaml)
- Local environment setup and management
- Database import/export operations
- Drush integration
- Xdebug and debugging tools
- Performance optimization
- Multi-site and custom commands
Available Topics
Core Setup
- @references/installation.md - Installing and configuring DDEV
- @references/config-yaml.md - .ddev/config.yaml reference
- @references/commands.md - Essential DDEV commands
Database Operations
- @references/database.md - Import, export, and snapshot workflows
- @references/drush.md - Using Drush with DDEV
Development Tools
- @references/xdebug.md - Debugging with Xdebug
- @references/mailhog.md - Email testing with MailHog
- @references/solr.md - Local Solr search setup
Advanced
- @references/custom-commands.md - Creating project-specific commands
- @references/hooks.md - Pre/post hooks automation
- @references/performance.md - Optimizing DDEV performance
- @references/multisite.md - Multi-site configuration
See /references/ directory for complete documentation.
Quick Reference
Essential Commands
ddev start
ddev stop
ddev restart
ddev ssh
ddev drush cr
ddev drush status
ddev drush config:status
ddev composer require drupal/module_name
ddev composer update
ddev import-db --file=backup.sql.gz
ddev export-db --file=backup.sql.gz
ddev snapshot
ddev logs
ddev logs -f
ddev describe
ddev launch
Basic .ddev/config.yaml
name: myproject
type: drupal10
docroot: web
php_version: "8.3"
webserver_type: nginx-fpm
database:
type: mariadb
version: "10.6"
nodejs_version: "20"
additional_services:
- solr
upload_dirs:
- web/sites/default/files
performance_mode: mutagen
Common Workflows
New Drupal Project
mkdir myproject && cd myproject
ddev config --project-type=drupal10 --docroot=web --php-version=8.3
ddev composer create drupal/recommended-project
ddev composer require drush/drush
ddev start
ddev drush site:install standard --site-name="My Site" --account-name=admin
ddev launch
Import Existing Project
git clone repo-url myproject && cd myproject
ddev start
ddev composer install
ddev import-db --file=path/to/backup.sql.gz
ddev import-files --source=/path/to/files
ddev drush updb -y
ddev drush cr
ddev launch
Database Sync from Pantheon
terminus backup:create site.env --element=db
terminus backup:get site.env --element=db --to=backup.sql.gz
ddev import-db --file=backup.sql.gz
ddev drush updb -y
ddev drush cr
ddev drush sql-sanitize -y
Daily Development Workflow
ddev start
git pull origin main
ddev composer install
ddev drush cr
ddev snapshot --name=before-testing
ddev snapshot restore --name=before-testing
ddev stop
Debugging with Xdebug
ddev xdebug on
ddev xdebug off
ddev xdebug status
VSCode launch.json:
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
}
}
Performance Optimization
macOS Performance (Mutagen)
performance_mode: mutagen
ddev restart
NFS Mount (Alternative for macOS)
nfs_mount_enabled: true
Database Tuning
database:
type: mariadb
version: "10.6"
[mysqld]
innodb_buffer_pool_size = 512M
innodb_log_file_size = 128M
Custom Commands
Create project-specific commands in .ddev/commands/web/:
Example: .ddev/commands/web/fresh-install
#!/bin/bash
set -e
echo "Installing fresh Drupal site..."
drush sql-drop -y
drush site:install standard \
--site-name="My Site" \
--account-name=admin \
--account-pass=admin \
-y
if [ -d /var/www/html/config/default ]; then
drush config:import -y
fi
drush cr
echo "Fresh install complete!"
echo "Login: admin / admin"
Make it executable:
chmod +x .ddev/commands/web/fresh-install
ddev fresh-install
Best Practices
- Commit .ddev/config.yaml - Share config with team
- Use ddev composer instead of local composer
- Don't commit database snapshots - Too large
- Create snapshots before risky operations
- Disable Xdebug when not debugging - Performance impact
- Use mutagen on macOS - Much faster file sync
- Regular ddev poweroff - Free up system resources
- Version pin services - PHP, database, Node.js
- Use hooks for automation - Post-start tasks
- Document custom commands - Help team members
Common Issues
Site Not Loading
ddev restart
ddev describe
ddev logs
ddev drush cr
Database Connection Error
ddev describe
ddev ssh
ls web/sites/default/settings*.php
Port Conflicts
ddev poweroff
lsof -i :80 -i :443
ddev config --router-http-port=8080 --router-https-port=8443
Slow Performance on macOS
ddev config --performance-mode=mutagen
ddev restart
ddev config --nfs-mount-enabled=true
ddev restart
PHP Deprecation Warnings in Drush
If you're seeing PHP deprecation warnings when running Drush commands (especially with PHP 8.4), create a custom PHP configuration file to suppress them:
.ddev/php/drush.ini:
[PHP]
error_reporting = 22527
display_errors = Off
display_startup_errors = Off
log_errors = On
error_log = /tmp/php-errors.log
Then restart DDEV:
ddev restart
How it works:
error_reporting = 22527 equals E_ALL & ~E_DEPRECATED
display_errors = Off prevents warnings from appearing on STDERR
display_startup_errors = Off suppresses bootstrap warnings
- Errors are logged to
/tmp/php-errors.log instead of being displayed
This configuration applies to both web and CLI contexts since DDEV copies .ddev/php/*.ini files to both /etc/php/[version]/cli/conf.d/ and /etc/php/[version]/fpm/conf.d/.
Docker Desktop overlay2 I/O Errors
If Docker Desktop gets into a bad state producing overlay2 or containerd I/O errors such as:
Error response from daemon: error creating temporary lease: write /var/lib/desktop-containerd/daemon/io.containerd.metadata.v1.bolt/meta.db: input/output error
Error response from daemon: open /var/lib/docker/overlay2/...: input/output error
A normal quit and restart of Docker Desktop is not sufficient. You must force quit ALL Docker processes (via Activity Monitor or killall -9 Docker / killall -9 com.docker.hyperkit), then relaunch Docker Desktop. Only a full force quit clears the corrupted state.
Unhealthy Containers / Mutagen Sync Hanging
After Docker crashes or force-quits, DDEV can get into a bad state where:
ddev start hangs at "Starting Mutagen sync process..."
- Web container reports unhealthy (
phpstatus:FAILED, mailpit:FAILED)
ddev mutagen reset fails with "CreateOrResumeMutagenSync Failure"
Fix (run in order):
ddev poweroff
ddev start
If ddev poweroff doesn't resolve it:
ddev stop
~/.ddev/bin/mutagen daemon stop
~/.ddev/bin/mutagen daemon start
ddev mutagen reset
ddev start
Monitoring commands while troubleshooting:
ddev mutagen status -l
ddev mutagen monitor
docker inspect --format "{{ json .State.Health }}" ddev-<project>-web
Multi-Project Management
ddev list
ddev poweroff
ddev delete <project-name>
ddev delete --omit-snapshot --yes <project-name>
Related Skills
- @drupal-pantheon - Deploy to Pantheon from DDEV
- @drupal-config-mgmt - Config management workflows
- @drupal-contrib-mgmt - Module management with Composer
- @drupal-at-your-fingertips - General Drupal patterns
Official Documentation: https://ddev.readthedocs.io
Drupal DDEV Quickstart: https://ddev.readthedocs.io/en/stable/users/quickstart/
Community Support: https://discord.gg/5wjP76mBJD