Share local Shopware with Expose to test on devices

Share local Shopware with Expose to test on devices

ยท

2 min read

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
  • Composer
  • Shopware 6
  • Expose

1 - Install Expose

1a - PHP Archive (PHAR)

curl https://github.com/beyondcode/expose/raw/master/builds/expose -L --output expose

chmod +x expose

./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 ~/.bash_profile (or ~/.bashrc, ~/.zshrc) like this:

export PATH=~/.composer/vendor/bin:$PATH

2 - Setup your authentication token

2a) Regsiter a new account at expose.dev/register

Register new account

2b) At dashboard you can see this

Expose Dashboard

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

cd public
valet secure
valet[sudo] password for tony:

Restarting php7.4-fpm...
Restarting nginx...

The [shopware.test] site has been secured with a fresh TLS certificate.

After that verify that the domain is secured with SSL

valet links

image.png

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
Local-URL:        shopware.test:443
Dashboard-URL:        http://127.0.0.1:4040
Expose-URL:        http://lcn5tuwgwl.sharedwithexpose.com:443
Expose-URL:        https://lcn5tuwgwl.sharedwithexpose.com

3c) With the new domain from expose, add these configurations to your Sales Channel domain

Adding the domain to saleschannel

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.

Shopware stofront page

From your mobile phone, access history and you can access the recent domain that from your computer.

Mobile phone access

Please verify that the assets CSS/JS are from the new domain as https://lcn5tuwgwl.sharedwithexpose.com

Happy coding!!! ๐ŸŽ‰

ย