DDEV and Craft CMS Quick-Start Guide
Let's imagine we're kicking off a new client project and we're excited about spinning up a brand new Craft CMS installation. We do it correctly by getting a standard local development environment setup, too.
As of version 1.21.2, DDEV supports a Craft CMS project type. A project type in DDEV offers additional commands and support for a CMS or framework. The Craft CMS project type speeds up the creation of new Craft CMS projects, especially the .env
file and the default database settings.
You’ll get the best experience using DDEV and Craft if you use the project type and the commands in the order I show them.
First, we will create a project directory and then cd
into that directory.
mkdir yellowstone
cd yellowstone
Next, we’ll run ddev config
to create the project:
ddev config --project-type=craftcms --docroot=web --create-docroot
We are passing in the project type as craftcms
, so DDEV knows to handle the setup process specifically for Craft and the docroot of web
and that DDEV should create the docroot via --create-docroot
.
We can start the DDEV project, spinning up the necessary Docker containers to install Craft CMS.
ddev start
Next, we’re ready to create our project using Composer. DDEV has a composer create
command, similar to composer create-project
. We’ll pass along some options to default to yes, not run scripts.
ddev composer create -y --no-scripts craftcms/craft
With the containers up and running, we can now run craft install
through ddev
and start the Craft installation process.
ddev craft install
Once Craft is installed, we can launch it in the browser via ddev launch
or navigate to the hostname set up for the project.
If you’re ever unsure of your project’s DDEV settings, you can use the ddev describe
command:
ddev describe
┌───────────────────────────────────────────────────────────────────────┐
│ Project: ddev-test ~/training/ddev-test https://ddev-test.ddev.site │
├────────────┬──────┬───────────────────────────────┬────────────────── ≈
│ SERVICE │ STAT │ URL/PORT │ INFO ≈
├────────────┼──────┼───────────────────────────────┼────────────────── ≈
│ web │ OK │ https://ddev-test.ddev.site │ php PHP7.4 ≈
│ │ │ InDocker: ddev-ddev-test-web: │ nginx-fpm ≈
│ │ │ 443,80,8025 │ docroot:'web' ≈
│ │ │ Host: localhost:64434,64435 │ ≈
├────────────┼──────┼───────────────────────────────┼────────────────── ≈
│ db │ OK │ InDocker: ddev-ddev-test-db:3 │ MariaDB 10.3 ≈
│ │ │ 306 │ User/Pass: 'db/db ≈
│ │ │ Host: localhost:64433 │ or 'root/root' ≈
├────────────┼──────┼───────────────────────────────┼────────────────── ≈
│ PHPMyAdmin │ OK │ https://ddev-test.ddev.site:8 │ ≈
│ │ │ 037 │ ≈
│ │ │ InDocker: ddev-ddev-test-dba: │ ≈
│ │ │ 80,80 │ ≈
│ │ │ `ddev launch -p` │ ≈
├────────────┼──────┼───────────────────────────────┼────────────────── ≈
│ Mailhog │ │ MailHog: https://ddev-test.dd │ ≈
│ │ │ ev.site:8026 │ ≈
│ │ │ `ddev launch -m` │ ≈
├────────────┼──────┼───────────────────────────────┼────────────────── ≈
│ All URLs │ │ https://ddev-test.ddev.site, │ ≈
│ │ │ https://127.0.0.1:64434, │ ≈
│ │ │ http://ddev-test.ddev.site, │ ≈
│ │ │ http://127.0.0.1:64435 │ ≈
└────────────┴──────┴───────────────────────────────┴────────────────── ≈
DDEV and Craft CMS Quick-Start Guide is made up of the following videos: