Mohamed Said has written a tutorial to show us how Valet works and how it's built.

So yesterday Taylor Otwell and Adam Wathan released Laravel Valet, it's simply a tool that helps OS X users easily run their websites locally for development purposes, without the need to configure anything each time a new project needs to be created.

The idea behind valet is that it configures PHP's built-in web server Caddy to always run in the background when the operating system starts, then it proxies all requests to a given domain to point to your localhost 127.0.0.1

Installation

Installing valet is very easy, you need to have Homebrew installed and updated to the latest version. You'll also need to install composer.

Now you need to run the following command:

composer global require laravel/valet

To be able to use valet's binary file globally, you need to make sure ~/.composer/vendor/bin directory is in your system's PATH, go ahead and check that:

echo $PATH

Finally, run the following command:

valet install

How it works

The install command does the following things:

Creates the configuration file for valet as well as a sample driver.

Installs an OS X daemon to run Caddy at system boot.

Installs PHP if it's not already installed.

Updates the PHP FPM configuration to use the current user instead of wwww.

Installs Dnsmasq and configures it to respond to all .dev requests.

Configures OS X to send all .dev requests to 127.0.0.1.

Creating Valet's configuration files

This task is fairly simple, Valet creates a new directory ~/.valet and add