LARAVEL

Laravel Herd Local Development

April 10, 2024 11 min read

Introduction

Laravel Herd is a blazing fast, native Laravel and PHP development environment for macOS. It includes everything you need to develop Laravel applications locally, including PHP, Nginx, and dnsmasq.

Installation

Download and install Herd from the official website. After installation, Herd automatically configures:

  • PHP 8.3, 8.2, 8.1, and more
  • Nginx web server
  • dnsmasq for local domains
  • Composer
  • Node.js and npm

Configuration

Configure Herd through the menu bar app:

# Herd stores configuration in
~/Library/Application Support/Herd/config/herd.env

# Set PHP version
PHP_VERSION=8.3

# Configure PHP settings
PHP_MEMORY_LIMIT=512M

Managing Sites

Add a new site to Herd:

# Using Herd CLI
herd link my-project /path/to/laravel-project

# Site is now available at
https://my-project.test

PHP Versions

# Switch PHP version for a site
herd php 8.2 my-project.test

# Available versions
herd php list

SSL Certificates

Herd automatically generates SSL certificates for .test domains:

# Generate SSL for a site
herd ssl my-project.test

# Trust the Herd CA certificate
herd trust

Summary

Laravel Herd provides an excellent local development experience for Laravel developers. With automatic SSL, multiple PHP versions, and native performance, Herd makes local development fast and enjoyable.

For more information, check out our other tutorials on Laravel Sail and Laravel Forge.