Laravel Valet: Minimalist PHP Development Environment

Zainal Hasan |

What is Laravel Valet?

Yup, as you can see on the title, Valet is a minimalist PHP development environment when you are using Mac OS that only needs less than 10 MB in action. Yeah, I am so sure about this. Why it can happen? Valet is a bundle for Nginx and DnsMasq that available only on Mac OS. No more confusion about /etc/hosts file, and sure it’s not draining the memory like Homestead or Vagrant.


  • Serve a site on a local domain, default is .test domain
  • Serve a site over encrypted TLS using HTTP/2
  • Share a project on the local network or worldwide using Ngrok easily
  • Switch PHP version using one command


  1. Mac OS and Homebrew
  2. PHP 7.4
  3. Composer

How to Install?

  1. Make sure port 80 and 443 in your local machine is not used by another application
  2. Update your Homebrew to the latest version using a command brew update
  3. Install Valet with Composer using a command composer global require laravel/valet. Make sure the ~/.composer/vendor/bin directory is in your system's "PATH"
  4. Run the valet install command. This will configure and install Valet Nginx, and DnsMasq. Then, register Valet's daemon to launch when your system starts.

How Does It Work?

Valet has a file config on ~/.config/valet/config.json. Valet has a directory ~/.config/valet/Sites/ that contains all symbolic links for linked projects. For example, when you run a command  valet link app-name,  it’ll create a symbolic link from the current working directory to the ~/.config/valet/Sites/ directory and command valet unlink app-name will remove the symbolic link. But, when you are using a command valet park, it’ll register the current directory to the config file that Valet should search for sites.

Basic Commands

  • Run command valet lists to see a listing of all linked directories
  • Run command valet park to register all first-level directories to link it to Valet. Any project you create in the “parked” directory will automatically be served using the folder-name.test convention.
  • Run command valet link app-name on your project root directory to link to Valet, then the project can be accessed in app-name.test (app-name can be replaced with anything you want)
  • Run command valet tld tld-name to change your TLD (tld-name can be replaced with anything you want, but I recommend you to not use real TLD except you will unable to access the real domain)
  • Run command valet secure to serve a site over encrypted TLS using HTTP/2
  • Run command valet share to share your project worldwide using Ngrok

Wanna know more? Read the docs that I was referred to at the end of this article. Thanks for reading.


Related post