Today we want to announce the release of our new Shopware Symfony Flex Composer template.
What is Symfony Flex?
Symfony Flex is a Composer plugin that takes care of all your configuration files. Each Composer package can have a recipe that contains configuration files like Symfony config YAMLs, and environment variables for your .env
or docker containers.
Why a new template?
What we want to achieve with this template, is to make the Shopware installation process a lot easier and less confusing. Before you had to decide whether to use the development template, the production template or the zip file from shopware.com, or even no template at all by simply using the platform repository.
All of these options caused confusion for developers as they used multiple templates for a project, since "production" only applies to deployment and other scenarios. Or the command between the templates was completely different or wasn't the same at all.
With this new template, we want to ditch all other templates and make the installation the same for any kind of project or developing extensions.
Don't worry! The current templates (development and production without flex) will still be supported until Shopware 6.5. With Shopware 6.5 the old templates won't get updated then.
So in short:
-
One method to install Shopware regardless of Docker or not
-
Few less files
-
No rebase against Shopware production anymore
-
Optional packages to get additional configurations
-
All environment variables are the same as Symfony default docs
-
MESSENGER_TRANSPORT_DSN
for queue -
MAILER_DSN
for Mailing -
OPENSEARCH_URL
for Elasticsearch/OpenSearch
The new template
The new template can be created with Composer create-project:
# dev-flex addition will be removed with Shopware 6.5
composer create-project shopware/production:dev-flex <project-name>
It uses, by default, the newest Shopware version. Update the created composer.json
to pin the version.
While creating the project, you get asked if you want to have Docker support or not. If you opt-in, you will get a docker-compose.yml
for all services like MySQL / Mailer.
After creating the project, you get a quick introduction on how to set up the project like this:
shopware/core instructions:
* Setup your repository:
1. Go to the project directory
2. Create your code repository with the git init command and push it to your favorite Git service
* Run locally Shopware:
1. Adjust the .env file to your database
2. Run ./bin/console system:install --basic-setup
3. Optional: If you use Symfony CLI start the webserver symfony server:start -d
4. The default credentials for administration are admin with password shopware
* Run with Docker Shopware with Symfony CLI:
1. Start the docker containers with docker compose up -d
2. Run symfony console system:install --basic-setup
3. Start the webserver symfony server:start -d
4. The default credentials for administration are admin with password shopware
5. Optional: Open the Mail catcher with symfony open:local:webmail
* Read the documentation at https://developer.shopware.com/
All the upcoming updates/config changes can be installed using composer update. See the docs for migration to the new template or in general.
More flexibility using recipes
As all configuration files are coming from our Recipes, you can install or uninstall composer packages to get rid of functionality or add more.
You don't want to use the default Shopware storefront? No problem. Just uninstall it:
composer remove shopware/storefront
So Flex will remove all Shopware Storefront-related config files and unregister it also from the config/bundles.php
.
Prebuilt recipes from Shopware
The new template currently offers two prebuilt recipes to get started faster with Shopware PaaS or Fastly.
If you are a Shopware PaaS customer or want to switch to it, you can turn in a single composer package for your current project to be PaaS-ready. Install the paas
package like below:
composer req paas
The flex plugin will show you like on the first setup, how you process to finish the setup.
The same can also be done for Fastly by installing the fastly
package. The package also contains all vcl files for Shopware.
Community driven Recipes
The Shopware Recipes repository is open to all people. If you have an idea of a recipe, you want to create, get in touch with us using GitHub issues and contribute to this project. You can find a Guide to create Recipes at the Symfony Repository.
An example of this is the Gitpod Recipe from FriendsOfShopware, which adds Gitpod to your project to develop in a Cloud IDE.
Conclusion
We want to unify with the new template how Shopware can be installed and improve the developer experience regardless of the environment of the user. Make it easier to adopt new configurations or add more functionalities by using different recipes.
Want to learn more about Symfony Flex?
You can read more about the new template in the docs, or join the channel #flex in the Shopware Community Slack.