Use Laravel Valet For Local WordPress Development on MacOS

Bryan Siegel
March 26, 2020

If you’re looking for a dead simple local development environment that works I highly recommend using Laravel Valet (if you’re using a Mac). My workflow consisted of using Mamp for WordPress while using Vagrant for everything else. Larvel 7 just recently came out and I’ve been using Valet for the first time and wondered if I could use it for WordPress development as well. Guess what you can!

Install Homebrew

First thing you’ll need to do is install Homebrew on your Mac. If you haven’t heard of Homebrew it’s basically a way of installing applications on your Mac through the command line.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
									

Setup Your Local Environment

Next we’ll need to setup Composer, PHP and your database of choice. I’m going with Mysql because ya know it’s what I use.

How to Install Composer with Homebrew

brew install composer
									

How to Install PHP with Homebrew

brew install php
									

How to Install and Start Mysql with Homebrew

brew install mysql@5.7
									

To start mysql as a service

brew services start mysql
									

Remember when we installed Composer via Homebrew? This is why. We need to install first Laravel then Valet via Composer.

How to Install Laravel

composer global require "laravel/installer"
									

Finally we install Valet via Composer

composer global require "laravel/valet"
									

Install Valet

valet install
									

Now that Valet is installed here comes the cool part. Wherever you put your websites in whether it’s a Sites or Code folder on your local machine is where your going to park Valet. Now this is the important part. Say for example, I create a BryanSiegelIsCool within my Sites or Code folder. Valet will auto-magically create a BryanSiegelIsCool.test url.

Valet Park

valet park
									

Now The WordPress Part

First we are going to need the WordPress Cli which is fancy talk for doing WordPress stuff through the command line.

Install The WordPress Cli through Homebrew

brew install wp-cli
									

How to Install a new WordPress website using Valet

Now all you need to do in order to create a new WordPress website using Laravel valet is by using the following command.

wp valet new bryansiegelisreallycool
									

There are all kinds of cool things you can do with Laravel Valet like turning https on or off or using a particular PHP version. For a list of commands visit the Laravel Valet docs

Tags

Web Development

Would you like to hire me?

Side projects, Employment Opportunities, you want to give me a [big bag] of money.

Contact