- Post-start hooks in detail
- Mailpit (email testing)
- Multi-container services (Redis, Elasticsearch, etc.)
- PHP customization
Hooks automate repetitive tasks after ddev start.
hooks:
post-start:
- exec-host: ddev mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS db_test; GRANT ALL PRIVILEGES ON db_test.* TO 'db'@'%'; FLUSH PRIVILEGES;"hooks:
post-start:
- exec: php Thelia cache:clearhooks:
post-start:
- composer: install # Shorthand for ddev composer installThe two theme families do not share a toolchain: the Flexy front office runs on AssetMapper
plus the Tailwind CLI binary and has no package.json, while the default-twig back office
is still a Webpack Encore theme.
hooks:
post-start:
- exec: php bin/console importmap:install
- exec: php bin/console tailwind:build
- exec: bash -c "cd templates/backOffice/default-twig && npm install && npm run build"hooks:
post-start:
- exec: symfony run --daemon bin/console messenger:consume async -vvNote: exec commands run inside the web container. exec-host commands run on the host machine.
DDEV includes Mailpit to capture outgoing emails.
# .env.local
MAILER_DSN=smtp://localhost:1025https://project-name.ddev.site:8026
All emails sent by the application are captured and visible in Mailpit.
# .ddev/docker-compose.redis.yaml
version: '3.6'
services:
redis:
image: redis:7-alpine
container_name: ddev-${DDEV_SITENAME}-redis
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
- redis-data:/data
restart: unless-stopped
volumes:
redis-data:Usage:
# .env.local
REDIS_URL=redis://redis:6379# Test the connection
ddev exec redis-cli -h redis ping; .ddev/php/custom.ini
memory_limit = 512M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300Restart after any modification:
ddev restart