Less than 5 Minutes Install with ddev and Symfony Flex¶
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. Its contents are:
#!/usr/bin/env bash
# What it does:
# - Creates a local Shopware installation using the Symfony Flex template for local development of client projects
# - Prerequisites: ddev installed on your machine, see https://ddev.com/get-started/
# - See also: https://docs.ddev.com/en/stable/users/quickstart/#shopware
#
# How to use:
# - create a project folder
# - copy this file into the project folder
# - chmod +x install.sh
# - ./install.sh
set -e
echo "Config ddev project (remember to adjust php and nodejs versions to your Shopware release!) ..."
ddev config --project-type=shopware6 --docroot=shopware/public --web-environment="APP_ENV=dev" \
--web-working-dir=/var/www/html/shopware --composer-root=shopware
ddev start
echo "Composer create-project shopware ..."
ddev composer create-project shopware/production -n
echo "Installing Shopware ..."
ddev exec bin/console system:install --basic-setup --shop-locale=de-DE
Then run the following command:
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 /adminto 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– this tells ddev to setup a Shopware 6 type project. ddev will create a.env.localfile within the project'sshopwarefolder with all relevant settings--docroot=shopware/public– this directive tells the webserver where to find the web root--web-environment="APP_ENV=dev"- read all environment variables from.env.dev--web-working-dir=/var/www/html/shopware– this defines the working dir for the web service--composer-root- if you want to use the ddev composer command, this tells ddev where to find your composer.json file
The next command – ddev start – starts your project containers.
Shopware itself then is installed with this command
Finally, the command
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
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.