We create beautiful websites on our local system, then deploy these to a demo server so others can see the updates. This approach is good when we are working with clients that need access to the demo website for review at any time they want. However, if working with different dev teams or need to do quick reviews with clients or peers, wouldn’t it be awesome if we can just share our local website over a public URL?
Introducing Expose – a beautiful, fully open-source tunneling service written in pure PHP.
With expose, we can easily share our local websites to a public URL all you need is Composer installed on your local computer and install expose globally to share your local websites.
If you don’t have composer installed on your computer, visit this link to install composer for the operating system you use.
To install expose open terminal and run this command.
$ composer global require beyondcode/expose
Setting the auth token:
You need an auth token to share your local websites via Expose server. Click here to access or get your authentication token and run the following command to save it globally on your computer.
expose token AUTH_TOKEN_HERE
Share your first website
To share a website running on local computer, run this cd into the project directory and run this command:
$ cd ~/Sites/my-local-project/ $ expose
This will generate a random subdomain and gives you a URL to share your local website over the internet which looks like this: https://random-domain.sharedwithexpose.com
Setting a custom subdomain
Expose makes it easy to use a custom subdomain for the public URL. To set a custom domain use –subdomain option like this:
$ cd ~/Sites/my-awesome-site/ $ expose share localhost:3000 --subdomain=my-awesome-site
Change locahost:3000 to your local website URL domain and port and the above command will share your local website running on localhost:3000 to https://my-awesome-site.sharedwithexpose.com
To verify test this URL in another tab or browser and if you see your local website with this URL, go ahead and share the public URL with anyone.
I use this tool very often and I hope you will also like this free and awesome tool.