Less than 5 Minutes Install with ddev and Symfony Flex

This page describes how to install Shopware in a local ddev environment, using Shopware's Symfony Flex template.

Why use ddev with Symfony Flex template?

If you’re used to using ddev to run your local projects, you’ll find it easy and straightforward to use the new Symfony Flex template to develop and contribute to client projects. While the template comes with its own Docker setup, one advantage of using it within ddev is that you do not need a local composer environment. In fact, the only prerequisites on your local machine are Docker and ddev.

Not to mention the benefits of ddev’s ease of use and flexibility.

Scripted Install

The first thing to do is create a project folder, let’s call it my-project, and cd into it. The name of this folder will be the project name used with ddev.

The easiest and quickest way for the install is to copy my installation script install.sh file from Github into your project folder. Then run the following command:

chmod +x install.sh && ./install.sh

When the installation script is finished, you will have

  • a current version of Shopware installed in the folder shopware.

  • Use the ddev ssh command to ssh into the project’s web container.

  • Browser-wise, your project storefront can be reached at https://my-project.ddev.site,

  • the project admin can be found at https://my-project.ddev.site/admin

  • or use the command ddev launch /admin to launch it directly in your preferred browser.

  • The admin credentials are admin and shopware.

The Script Explained

The first command – ddev config – creates a configuration file for your ddev project with these settings:

  • --project-type=shopware6 – ddev uses the project type to initiate some basic settings (e.g. DATABASE_URL) in a .env.local file. Note I have kept this parameter in my example, thought at the time of writing, I prefer not use the ddev defaults.

  • --disable-settings-management – leaves you in full control of the .env.local file

  • --docroot=shopware/public – this directive tells the webserver where to find the web root

  • --create-docroot – you need to tell ddev to create the docroot, otherwise it would complain a missing docroot and exit

  • --web-working-dir=/var/www/html/shopware – this tells ddev to move into this directory when you use the ddev ssh command

  • --database=mysql:8.0 – I recommend to use mySQL as a database, instead of the default MariaDB used by ddev

  • --php-version=8.2 – you may want to adjust the php version to your needs

  • --nodejs-version=20 – you may want to adjust the nodejs version to your needs

  • --webserver-type=apache-fpm – I recommend to Apache here (instead of ddev’s default nginx), as it is kind of Shopware standard

  • --web-environment-add="..." – this command initializes all relevant environment variables for Shopware, thus we do not need a .env.local file

The next command – ddev start – starts your project containers.

Shopware itself then is installed with this command

ddev exec "cd /var/www/html && rm -rf shopware/ && composer create-project shopware/production shopware -n"

We need to play a little trick here and remove the shopware folder created earlier by ddev, because composer create-project requires a non-existent target project folder.

Finally, the command

ddev exec bin/console system:install --basic-setup --shop-locale=de-DE

initializes the Shopware system and database. Carefully chose your shop locale here (as either de-DE or en-GB) as it might be a bit tricky to change it afterwards.

Use Traditional Install for < 6.5

Note that this Symfony Flex based approach is applicable only for Shopware 6.5.0.0 and above. Should you need to install an earlier version, follow the „traditional“ approach, i.e. setup the ddev project and then use the Shopware-provided installation zip file and install it within your ddev project.

Updating Shopware and Plugins

With Symfony Flex, updating is now just a matter of running composer update – you do not even need Shopware’s shopware-installer.phar.php. Just run

bin/console system:update:prepare
composer update
bin/console system:update:finish

You may want to restrict the composer update command to particular versions, components or plugins.

After running composer update, check that you recipes are up-to-date with the command composer recipes. Apply updates as advised.

Last updated