Skip to main content

Ddev: Drupal 9 Composer Setup Example and sharing it online with database backup (export - import)

This is a quick process to setup a drupal 9 ready ddev website. Original post can be found here:…

mkdir my-drupal9-site
cd my-drupal9-site
ddev config --project-type=drupal9 --docroot=web --create-docroot
ddev start
ddev composer create "drupal/recommended-project"
ddev composer require drush/drush
ddev drush site:install -y
ddev drush uli
ddev launch

Drupal 9 Git Clone Example

Note that the git URL shown below is an example only, you'll need to use your own project.

git clone
cd example-site
ddev config --auto 
ddev config --project-type=drupal9 --docroot=web --create-docroot
ddev composer install
ddev launch

Sharing your project with others

Even though DDEV is intended for local development on a single machine, not as a public server, there are a number of reasons you might want to expose your work in progress more broadly:

  • Testing with a mobile device
  • Sharing on a local network so that everybody on the local network can see your project
  • Some CI applications

There are at least three different ways to share a running DDEV-Local project outside the local developer machine:

  • ddev share (using ngrok to share over the internet)
  • Local name resolution and sharing the project on the local network
  • Sharing just the http port of the local machine on the local network

Now when you want to take a backup of the database the command is:

 ddev export-db --file=../db-wpi.sql.gz

 ddev export-db --file=../db.sql.gz //you can choose a path outside your web root of course

For importing a database

ddev import-db --src=dumpfile.sql.gz