Share local Shopware with Expose to test on devices
There are times when you develop a new theme for Shopware and you want to test it on mobile devices but you are too lazy to deploy it to the staging server yet. So here come the expose to rescue you.
TLDR; You will need these tools for this tutorial:
- Valet+/Valet Linux
- Shopware 6
1 - Install Expose
1a - PHP Archive (PHAR)
curl https://github.com/beyondcode/expose/raw/master/builds/expose -L --output expose
chmod +x expose
You most likely want to put the expose.phar into a directory on your PATH, so you can simply call expose from any directory. For example:
sudo mv expose.phar /usr/local/bin/expose
1b - Via Composer
Expose is a PHP application and you can install the client for your local machine as a global composer dependency:
composer global require beyondcode/expose
Make sure that your global composer directory is inside of your PATH environment variable. Simply add this directory to your
PATH in your
~/.bashrc, ~/.zshrc) like this:
2 - Setup your authentication token
2a) Regsiter a new account at expose.dev/register
2b) At dashboard you can see this
Please authenticate your token as this command-line.
expose token YOUR-TOKEN CODE
3) Share your Shopware website
3a) Secure the domain
Go to your directory that contain the shopware core repository
valet[sudo] password for tony:
The [shopware.test] site has been secured with a fresh TLS certificate.
After that verify that the domain is secured with SSL
Please notice the X at your SSL column.
3b) Expose your shopware.test domain
expose share https://shopware.test
Trying to use custom domain: https
You are not allowed to specify custom subdomains. Please upgrade to Expose Pro. Assigning a random subdomain instead.
Status: Expose Free - 👉 Upgrade to Pro at https://expose.dev/get-pro
3c) With the new domain from expose, add these configurations to your Sales Channel domain
Remember to save it after adding the domain.
3d) Now try to access lcn5tuwgwl.sharedwithexpose.com from your chrome or your favourite browser. 🍻 voila magic happens.
From your mobile phone, access history and you can access the recent domain that from your computer.
Please verify that the assets CSS/JS are from the new domain as
Happy coding!!! 🎉