Run Shopware 6 locally on your MacOs using Valet+

Without a doubt, 2020 is going to be the year of Shopware 6. The first stable version just released (when writing this article) a month ago. This means we should be able to build our first full Shopware 6 ready for public release. The Shopware 6 docs look pretty thorough but lack on other install methods besides docker like using Valet+.

Image for post
Image for post

Let’s get started

Ok enough with the chit chat, in order to get started with Shopware 6 and Valet+, this is what you need to do!

  • You run PHP 7.2 or higher in both your CLI and Valet+
    - $ valet use 7.2
  • Add the following to your .bashrc or .zshrc file to make sure you run the same PHP version in your CLI:
  • Restart your CLI or run $ source [location of your bash or zsh file]

Now that Valet+ and your CLI run on the same identical PHP version it’s time to install Shopware6, at the moment there’s no composer create yet so we need to clone the development version of Shopware. On the contrary to the install instruction, I choose to install the Shopware platform via composer instead of cloning one repo into another.

  • Clone development repo
    - $ git clone git@github.com:shopware/development.git shopware-valet
  • Go to the cloned repo
    - $ cd shopware-valet
  • Run composer install inside the cloned repo
    - $ composer install
  • Link the shopware-valet/public folder to a domain
    - $ cd public
  • Create domain and link to the public folder:
    - $ valet link shopware-valet
    🚨🚨 Note: Do not secure your domain, it messes with the hot proxy! and it’s dev environment so who cares :) 🚨🚨
  • Go back to the root folder $ cd ../ and run the setup: $ bin/setup:
    - Choose dev
    - Fill out your test domain with http: http://shopware-valet.test
    - Fill out your database credentials, for valet the user and pass are normally root/root
    - Wait for the installation to finish
  • Visit http://shopware-valet.test to validate your install works as expected! 🎉

Congratulations you’re ready to develop on a Valet+ installed Shopware platform!! But wait…, you as a modern developer definitely wants to develop using hot reload, running $ ./psh.phar storefront:hot-proxywill result in Valet not being able to find your install with a port.

Image for post
Image for post

To fix the hot proxy we need to dive in the core of Shopware6 and adjust a few things, to save you the trouble I’ve created a small plugin that fixes this for you. The repository of this plugin can be found at https://github.com/mmeester/shopware6-dev-tools

  1. Install the plugin $ composer require mmeester/shopware6-dev-tools --dev
  2. Detect new plugins: $ bin/console plugin:refresh 👉 Check if the plugin DevTools is listed.
  3. Install & activate the plugin: $ bin/console plugin:install — activate DevTools

The DevTools plugin has a few commands you can explore and will definitely speed up your dev time, but for now, we are going to fix the hot proxy by running: $ bin/console dev:hot-proxy-fix , run $ ./psh.phar storefront:hot-proxy and see the magic work.

Please keep in mind that the fix is based on the Shopware 6.1.1 release, new releases can break this hot proxy fix, but drop me a line or contribute to the plugin to fix this more solid in the future!

Written by

Co-founder of Matise

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store