Laravel Herd is a new kid on the block that comes as a “replacement” for the Laravel Valet. In this quick article we’ll cover what it is, pros and cons of using it and how to set up a local WordPress development environment.
So, Herd is a lightning-fast, macOS-based development environment tailored for Laravel but also works with WordPress and PHP. Packed with essential tools like PHP and nginx, it provides everything you require to kickstart your WordPress development environment.
- It doesn’t require a VM to be run in order for it to work.
- It uses static binaries for PHP and nginx, which makes is really really fast.
- It gives you ability to manage different PHP versions with a single click (PHP 7.4, 8.0, 8.1, 8.2, 8.3).
- It doesn’t support any other OS other than macOS.
- There’s no way of installing PHP extensions at the moment.
Go to this link and download the DMG file. Open the file and drag the Herd icon to the Applications folder. Once it’s installed, open it up.
WP-CLI is an amazing tool that can help you out with all things WordPress related. So let’s install it.
Open up your Terminal and run the following command:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Next step is to move it so that you can use
wp command – so run the following commands:
chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp
Creating our first WordPress Website
Open up your terminal once again and:
- Go to the Herd projects directory:
- Create a new folder and open it up:
mkdir example && cd example
- Download WordPress:
wp core download
- Configure website database:
wp core config --dbname=example --dbuser=root --dbpass= wp db create
- Install WordPress:
wp core install --title=Example --url=example.test --admin_user=example_user --email@example.com --admin_password=example_password
- Clean up the WordPress install:
wp site empty --yes
- Remove all plugins and themes that we don’t need:
wp plugin delete --all && wp theme delete --all
- Make sure that the website uses https:
wp search-replace http https
- Then, open up Herd Settings -> Sites and click on the little lock icon next to your example website or simply run the following command inside your WordPress project:
Now your WordPress website is up and running and you can access it by typing in your browser its address: