Migrating from Laragon to Herd

While Laragon and Herd are both development environments for PHP and Laravel, they have some key differences in their approach. This guide helps you migrate your existing Laragon setup to Herd while maintaining your productivity and existing projects.

Key Differences

Here are the main differences between Laragon and Herd:

  • Herd is tailored to Laravel, mirroring standard deployment setups closely
  • Herd manages PHP versions automatically
  • Herd comes with nvm for Node.js version management
  • Herd (Pro) ships with debugging tools and a common services

Before You Start

Before migrating to Herd, make sure to:

  1. Document your current Laragon setup (PHP versions, database names, etc.)
  2. Export any important databases
  3. Shutdown Laragon
  4. Install Herd

Directory Structure

While Laragon keeps all projects in its www directory by default, Herd uses the concept of parked paths. By default, Herd creates and uses %USERPROFILE%\Herd as the parked directory.

You have two options for your existing projects:

  1. Move them to the Herd directory
  2. Add your Laragon www directory as a parked path in Herd

Option 1: Moving Projects

  1. Copy your projects from the Laragon www directory to %USERPROFILE%\Herd
  2. Each project will automatically be available via http://directory-name.test

Option 2: Adding Laragon Directory

  1. Open Herd settings
  2. Go to “General” settings
  3. Add your Laragon www directory to the parked paths
  4. All projects in that directory will be available via http://directory-name.test

PHP Versions

Herd manages PHP versions differently than Laragon. Instead of downloading PHP versions manually, Herd provides an easy interface to install and manage PHP versions:

  1. Open Herd settings
  2. Go to “PHP” settings
  3. Install the PHP versions you need
  4. Isolate projects to specific PHP versions if needed

Database Migration

MySQL

If you’re using MySQL databases in Laragon, you’ll need to:

  1. Export your databases from Laragon’s MySQL
  2. Set up MySQL in Herd (via Herd Pro or dbngin)
  3. Import your databases into the new MySQL instance

Exporting from Laragon

# Using mysqldump from Laragon's MySQL
cd C:\laragon\bin\mysql\mysql-{version}\bin
mysqldump -u root --all-databases > all_databases.sql

Importing to Herd

If you’re using Herd Pro:

  1. Install MySQL via the Services tab or via dbngin
  2. Use TablePlus or AdminerEvo to import your databases
  3. Update your projects’ .env files with the new database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3307 # Default Herd Pro MySQL port
DB_DATABASE=your_database
DB_USERNAME=root
DB_PASSWORD=

PostgreSQL

If you’re using PostgreSQL, the process is similar:

  1. Export your databases from Laragon’s PostgreSQL
  2. Set up PostgreSQL in Herd Pro or standalone
  3. Import your databases
  4. Update your connection settings
# Nginx equivalent
location / {
    try_files $uri $uri/ /public/index.php?$query_string;
}

SSL Certificates

If you’re using SSL certificates in Laragon:

  1. Note which sites need HTTPS
  2. Use the secure sites feature in Herd
  3. Run herd secure for each site needing HTTPS
cd %USERPROFILE%\Herd\your-project
herd secure

Node.js and NPM

Herd includes nvm for Node.js version management:

  1. Install needed Node.js versions via Herd settings
  2. Optionally isolate projects to specific Node.js versions

Mail Testing

If you used Laragon’s built-in mail features:

  1. Configure Herd’s mail service (Herd Pro)
  2. Update your .env files with the new mail settings
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=${APP_NAME}
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Troubleshooting

If you encounter issues during migration:

  1. Check the common issues section
  2. Verify file permissions
  3. Check the Herd logs
  4. Make sure old Laragon services aren’t running

Running Both Side by Side

During migration, you can run both Herd and Laragon, but:

  1. Don’t run them simultaneously
  2. Stop all services in one before starting the other
  3. Watch for port conflicts, especially with databases

Final Steps

After migrating:

  1. Test all your applications thoroughly
  2. Update documentation and deployment scripts
  3. Consider uninstalling Laragon once everything works
  4. Set up Herd Pro features like Dumps and Log Viewer

For detailed information about specific features or troubleshooting, consult the relevant sections of the Herd documentation.