What Is Laravel Valet, and Why All the Fuss?

Bruno Skvorc
Bruno Skvorc

Yesterday, Taylor Otwell released Laravel Valet.

Valet icon

If you’re just interested in the broad strokes of what it is, who it’s for, and how it works, watch the funny (and slightly NSFW) video below. If you’d like to go more in depth and find out some more details about the product, and learn why it caused such a polarizing fuss on Reddit and Twitter, read on after the jump.

Broad strokes

Valet is a tool which makes spinning up demo or discardable projects a breeze.

It’s a tool which combines some of the default software on OS X with some ideas about filepaths and serving of PHP apps, and some additional tools for skipping the need to modify the /etc/hosts file. Additionally, it allows for forwarding of access to the local application over the public internet when needed.

Unlike Vagrant or Docker It offers no isolation, making all apps use the same globally available software. Why this is important to note will be explained below.


Let’s dive into the particulars, one by one.

OS X only

Valet is currently OS X only. This is currently the number one complaint from newcomers running into Valet.

While, technically, it should be possible to make it work on Linux given the amount of architecture the two systems share and the fact that most Linux distros have an old version of PHP pre-installed, Windows will likely never become an option without a full, OS-specific rewrite.

It’s not a conspiracy. Taylor does not belong to the cult of Apple, and he isn’t trying to be elitist. It’s just very easy to develop projects like these for OS X because of a very good package manager (Homebrew) and sensible defaults already being pre-installed.

Shared system state

Due to not using VMs or containers, Valet relies on the version of PHP installed on OS X. Not many people know this but OS X in fact ships with PHP pre-installed, though an admittedly outdated version (at the time of writing it defaults to 5.5.31). While that version is enough for running the most rudimentary applications, it’d be a shame not to use the most recent version.

To update to PHP7 on OS X using Homebrew, first install Homebrew and then run:

brew update
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php70
brew cleanup

Finally, make OS X execute the new PHP by default by adding the following line to your ~/.bash_profile file:

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

Then, either relaunch your terminal windows or run source ~/.bash_profile for the change to take effect.

PHP 7 running on OS X

Note that you also need to have Composer installed globally for Valet to work.

This is one of the major downsides of Valet, by the way, and akin to using MAMP or XAMPP and similar tools – all the apps will be using the same database / PHP version / extensions. That means the dependence on one can ruin other apps’ dependence on others. Be careful in starting serious projects with Valet!

Automatic virtual host

Valet uses DnsMasq to simulate virtual hosts in that it takes any folder name you create with it and makes the app within accessible via a {foldername}.dev domain.

For example, if you run valet park in a specific folder, Valet will search said folder for project setups matching the ones it supports and immediately make them accessible in the browser with the .dev suffix. Thus, creating a new Laravel project in ~/my-sites/laravel will make the site available on http://laravel.dev.

Note that for this to work, you do not need to touch etc/hosts at all, as opposed to the situation with Vagrant.

This makes previewing the demo apps you’re building much, much simpler, and completely skips the need for Apache or Nginx configuration – a tremendous headache for most people.

Valet uses .dev by default. While not in widespread use, .dev is actually a valid top level domain. Valet can be configured to use a different suffix, however. After installing it with Composer (preferably globally) enter its home folder and find the file config.json. There will be a domain key there with the value .dev. Changing this to something like .devlocal should do the trick.

Dev / prod parity

If you’ve read my book, you might be wondering “But what about dev / prod parity?”

You’d be right to wonder – it’s quite a big deal. The environment you’re developing in this way is so far removed from any possible production environment, it’s practically ludicrous to expect anything to run the way it does during development. That’s why Valet is suitable only for:

  • demo / throwaway projects
  • or, people who are absolutely certain they’ve configured their prod environment to match all the conditions of the app as developed under Valet

The latter is quite the impossibility, so I doubt we’ll see many serious, long term projects developed with Valet.

Vendor-lock (with a caveat)

Right now, Valet supports only the following types of applications:

This is because it relies on a specific file and folder layout to properly host things with the built-in PHP server. However, Valet does support custom drivers which allow for extending the tool and adding new ways to host alternative application structures.

Keep this in mind when you try to run your custom application with it and find it not working!

Live self-hosted preview

One of the major selling points of Valet is the ease with which one is able to share a work in progress with a client or another developer. Running valet share in an application’s folder will make it publicly available online via an automatically generated link. To stop sharing the site, simply stopping the service with Ctrl + C does the trick.

Behind the scenes, Valet uses Ngrok to accomplish this.


Sure, the entire set of tools in Valet is something you can use on your own, too, but in typical Laravel fashion, many smaller, useful things have been put in one convenient package to make the entire process of developing and debugging an app much faster. After all, what is Laravel itself if not a collection of incredibly handy packages all wrapped up in one extremely practical whole?

For more information about Laravel Valet, please see the documentation. We won’t be abandoning our Homestead Improved any time soon in favor of Valet (cross-platform friendliness is more important to us), but there’s definite value in Valet – from handy tools that expedite the sharing and self-hosting process to resource usage (only about 7MB of RAM!), Valet has a plethora of advantages over setups like MAMP or XAMPP.

Will you be using it?

Frequently Asked Questions about Laravel Valet

What makes Laravel Valet different from other development environments?

Laravel Valet is a minimalist development environment that requires less configuration compared to other environments like Homestead. It doesn’t use Vagrant or Docker, instead, it uses the built-in PHP server for hosting the applications. This makes it lightweight and fast. It also provides a secure tunneling feature using Ngrok, which allows you to share your local sites publicly.

How can I install Laravel Valet on my system?

Laravel Valet is easy to install. First, you need to have Homebrew installed on your Mac. Then, you can install Valet using Composer by running the command ‘composer global require laravel/valet’. After that, run ‘valet install’ in your terminal. Valet will install itself and configure your system automatically.

Can I use Laravel Valet with other PHP projects, not just Laravel?

Yes, Laravel Valet is not limited to Laravel projects. It supports other types of PHP projects as well. You can use it with Lumen, CakePHP, WordPress, Symfony, and other PHP frameworks or CMSs.

How can I share my local sites publicly using Laravel Valet?

Laravel Valet provides a feature to share your local sites publicly using Ngrok. You just need to navigate to your site’s directory in the terminal and run the command ‘valet share’. This will provide you with a public URL that you can share.

How can I secure my sites with HTTPS using Laravel Valet?

Laravel Valet provides a simple command to secure your sites with HTTPS. Just navigate to your site’s directory in the terminal and run the command ‘valet secure’. This will create a secure TLS certificate for your site.

How can I switch PHP versions using Laravel Valet?

Laravel Valet allows you to switch between different PHP versions easily. You can use the command ‘valet use php@version’ to switch to a specific PHP version. For example, ‘valet use php@7.4’ will switch to PHP 7.4.

How can I park my projects using Laravel Valet?

Laravel Valet provides a feature to park your projects in a specific directory. You can use the command ‘valet park’ in your projects directory. This will make all the projects in that directory accessible via the ‘.test’ domain.

How can I link a specific project using Laravel Valet?

If you want to link a specific project without parking the entire directory, you can use the ‘valet link’ command. Just navigate to your project’s directory in the terminal and run ‘valet link project-name’. This will make your project accessible via ‘project-name.test’.

How can I uninstall Laravel Valet from my system?

If you want to uninstall Laravel Valet, you can use the command ‘valet uninstall’. This will remove Valet and its configurations from your system.

How can I update Laravel Valet to the latest version?

You can update Laravel Valet to the latest version by running the command ‘composer global update’. This will update all your globally installed Composer packages, including Valet.