In this video, we're going to talk about running Laravel's Valet environment—in a follow-up to the previous video which talked about installing Composer and Valet.
You can read more about Valet on its documentation site, but the main thing we want to use is the park command. To start using Valet make sure you're in your Sites
directory in Terminal, and then run valet park
. Once you've done this once, any directory you add to your Sites
folder (including a Statamic directory) will automatically be mapped as http://directoryname.test
Valet Preferences
There are a couple of preferences I recommend you add. Firstly if you don't like the .test
tld that Valet defaults to, you can change this by running something like valet tld wip
– which would change the TLD to .wip
e.g. http://nameofyoursite.wip
. I recommend .wip
because macOS can run into issues if you use .local
and secondly, wip
is one of Statamic's recognised “developer” domains.
Secondly, if you'd like to run your local site over HTTPS you can run valet secure nameofyourdomain
. Bear in mind, unlike the park command, you'll need to secure every directory you create. Thankfully though Valet will remember secured sites whenever it starts up.
Running Valet
Valet will start up whenever you log into macOS, so you don't need to worry about manually typing valet start
every time. It is worth bearing in mind that you'll want to stop valet if you'd like to access a site running on MAMP. I wrote an article on using MAMP and Valet on the same system here.