Valet Cheatsheet
Serve a single site
After installing your php framework or cms, run the below command in your projects root directory, you can now access the site at the currentdirectoryname.test
1
valet link
As the docs say run this command in your sites directory to create test sites of all sub sites
1
valet park
Stop Valet
1
valet stop
List Valet links
display what links you have
1
valet links
Troubleshooting
502 bad getway. when trying to access local valet site. Running this command fixed it for me:
1
valet install
How to fix Valet after Brew upgrade
The confusing thing about Valet is that it’s installed with composer, but you use brew to install PHP.
So when you run into trouble with Valet, you often don’t know where to turn. Is the problem with homebrew or is it with Valet?
Recently, I found that after running brew update, everything fell to shit. My local websites powered by Valet no longer worked.
I was getting 502 bad gateway error. When I looked this up on the internet, I could see the error meant that Valet was confused about which version of PHP to use.
How to get Laravel Valet working after brew upgrade
The answer to my problem this problem I found was on the valet Install instructions page in the setting the php version section.
1
valet use php@8.1
This function ensured Valet was using the correct version of PHP and fixed the 502 error. mywebsite is now loading.
Brew Doctor
1
brew doctor
When i run brew doctor it tells me i have some unlinked kegs - but i dont care my local website is working so i will just leave sleeping dogs lie
1
2
3
4
5
6
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
composer
php
node
Brew Services List
1
brew service list
When i run the brew services list command, I see
- php8.1 status is none and the user is root.
- php (versionless) is also listed with a status of none an the user is actually empty (nothing listed at all).
- Nginx and dnsmasq status is none, user is root.
Considering that brew is installs php i would think that these services would be running.
Which PHP
When i run which php i get
1
/usr/local/opt/php@8.1/bin/php