Using Laravel Valet with Perch

Posted by Ryan Gittings

I've recently made a switch from MAMP Pro, to Laravel Valet. There's several reasons for switching:

  • Performance - MAMP Pro had started slowing down with every major version and it'd become pretty horrible to work with.
  • Setup across machines - Valet makes it easier to setup a site from the terminal, major win

Getting Started

The Laravel Valet docs provide a good guide to get started, but here's the low down...

  • Make sure Homebrew is installed
  • Make sure Composer is installed
  • Install Valet via Composer composer global require laravel/valet. I had an issue with the valet command not being found, I fixed it by following this thread
  • Run valet install

Creating a .test domain

To create a project with a .test domain, simple cd to your folder, and run valet link. This will automatically use the folder name as the domain name, e.g. ryan-gittings.test.

Getting Valet working with Perch

Valet runs a little differently that a standard server. As Valet runs on nginx, .htaccess files don't work. To create a local environment that'll run Perch, and Perch Runway we need to install some drivers to make sure it works out of the box. I've created two drivers for both Perch and Perch Runway, which can be found below:

To install these, navigate to the ~/.config/valet/Drivers folder, and drop the two files in there. All your Perch builds should now start working locally, huzzah!