A complete tutorial for installing Laravel Herd, configuring PHP, and creating and managing multiple Laravel projects in Windows.

🌍 The French version of this publication : Laravel Herd : Comment installer, configurer et créer un projet Laravel

Introduction

When developing a web application with the Laravel PHP framework, it's essential to have a development environment that includes a web server with integrated PHP, a database server (if required), Node.js, and Composer, in addition to a code editor and web browser.

Among the most popular web servers are Apache and Nginx, while for databases, MySQL, PostgreSQL, or SQLite are often used.

To simplify setting up a complete development environment for Laravel, Laravel Herd offers a turnkey solution. This software integrates Nginx, PHP and Node.js by default, and also offers additional services in its Pro version, such as :

  • Mail: for testing and debugging emails locally.
  • Dumps: to intercept dump() and dd() calls in your code
  • Log Viewer: for viewing logs.
  • Meilisearch: search engine.
  • MinIO: storage solution.
  • MySQL: database.
  • Redis: cache and queue management.

Laravel Herd simplifies service configuration and web project management by centralizing everything in one place.

This tutorial guides you through installing Laravel Herd on Windows, downloading PHP into Herd, managing web and database servers, creating a Laravel project, and launching it in the browser.

Finally, for those using Windows, a popular alternative to Laravel Herd is Laragon. See our tutorial How to create a Laravel project with Laragon for more information.

Installing Laravel Herd

To install Laravel Herd, start by downloading the software from the official website: https://herd.laravel.com. Select the version corresponding to your operating system. In this tutorial, I'm using Windows 11.

Download Laravel Herd

Once you've downloaded the file, run it to start the installation. The procedure is simple: just follow the steps by clicking on the Next button.

When installation is complete, a Laravel Herd icon will appear on your desktop. Double-click on it to launch the application. You'll be greeted by the main interface, also known as the Dashboard.

Laravel Herd dashboard

The Laravel Herd dashboard is organized into several sections:

  • The menu on the left, below the Laravel Herd logo
  • Active Services: This section displays all active services. You can easily start or stop all services by clicking on the Stop All Services button.
  • Global PHP Version: Here you can define a global PHP version for your projects.
  • Herd Pro: Access features such as Dumps, Mail and Log Viewer.
  • Quick Access: Get quick access to your websites.

When Laravel Herd is minimized or closed, its icon is moved to the notification area (near the clock). A left-click on the icon opens the main interface, while a right-click displays a context menu with additional options.

Laravel Herd in the notification area

Installing and configuring PHP in Herd

With Laravel Herd, you can manage multiple versions of PHP within your development environment and choose the one that best suits each Laravel project. This flexibility is particularly useful if you're working on projects requiring different versions of PHP.

Installing a new PHP version

To install a new version of PHP, follow these steps:

  1. Make sure your computer is connected to the Internet.
  2. In Laravel Herd's main interface, click on the PHP menu in the left-hand side panel.
  3. In the Versions section, click on the Install button next to the desired version. For example, you can install PHP 5.3 as shown below.

Installing PHP in Laravel Herd

Once the installation is complete, you can define this version as a global version in the Global PHP Version section of the Dashboard.

Additional configurations

Laravel Herd also offers options for customizing PHP to suit the needs of your projects. These options can be accessed from the same PHP menu, under the Versions section:

  • Max File Upload Size: Allows you to configure the maximum size of files PHP can accept for upload, expressed in megabytes (MB).
  • Memory Limit: Determines the maximum amount of memory your PHP scripts can use. This is useful for preventing greedy scripts from consuming too many resources.
  • Base Port: Set the base port PHP should use, which can be useful if you're running several servers in parallel.

These configurations enable you to tailor your development environment to perfectly match your project requirements.

Creating a Laravel project in Herd

Laravel Herd makes it much easier to create a Laravel project by automating several steps. Here's how it works:

Step 1: Add a new site

  1. From the dashboard, click on Open Sites in the Quick Access section.
  2. Then click on Add Site to add a new website.
  3. In the options that appear, select New Laravel Project and click Next.

Creating a new site in Laravel Herd

Step 2: Choose a starter kit (optional)

In this step, you can choose a starter kit for your Laravel project:

  • Laravel Breeze: A light, simple configuration for authentication.
  • Laravel Jetstream: A more advanced solution with features such as team management and sessions.
  • No starter kit: If you prefer to start from a classic Laravel base without a starter kit.

Make your choice according to the needs of your project.

Laravel Starter Kit in Laravel Herd

Step 3: Configure your project

  1. Give your project a name: fresh-laravel for this example.
  2. Select a testing framework (Pest or PHPUnit).
  3. Choose the folder in which your project will be created.

Configuring a Laravel project in Laravel Herd

Once your project is configured, click on the Next button and let Laravel Herd take care of the rest: installation of the Laravel framework, initial configuration and dependency management are all fully automated.

Progress of the creation of a new Laravel project in Herd

When installation is complete, click Open in Browser to open your new Laravel project directly in your browser. You can now start developing your application.

Completed installation of a Laravel project in Herd

Each Laravel project launched with Herd has a local URL suffixed with the .test domain. For example, for the project named fresh-laravel, the URL will be: fresh-laravel.test

Managing multiple Laravel projects in Herd

From the dashboard, click on Open Sites in the Quick Access section. This will take you to the General menu for the selected project, where you can :

  • View a screenshot of your application.
  • Use the Open button to :
    • Open Terminal (Windows PowerShell).
    • Launch PhpStorm (or any other configured IDE).
    • Access Tinker to execute Laravel commands.
    • Use Adminer to manage your database.
  • Choose PHP and Node version.
  • Activate HTTPS to secure your application.
  • View your application's PATH path. Click on it to explore your project files.
  • View your application's URL. Click on this URL or open it in your browser to access your Laravel application directly.

General menu for a Laravel app in Herd

The Information menu (below General) of the selected application provides useful details about your project, including :

  • Environment information.
  • Cache settings.
  • Drivers used by Laravel.

This information can be useful when debugging or configuring your project.

Information menu of a Laravel Herd app

As you can see, to add a new Laravel project, simply click on the Add button.

Adding a new project to Laravel Herd

Conclusion

Laravel Herd is a powerful and practical tool that simplifies the management and development of Laravel projects. By centralizing all stages, from creation to management, it optimizes your workflow and lets you concentrate on the code.

I'm convinced that this tool will be a great help in your Laravel projects. Happy development and take care! 😊