Herd for macOS

Documentation

Manage PHP versions

#
Using different PHP versions

By default, Herd ships with the latest stable PHP version, which is currently 8.2. However, you may want to install and use different PHP versions for your projects.

#
Via the GUI

You can manage your PHP versions in the "PHP" tab of the preferences window. Here you can choose which PHP versions you want to install or update.

In order to change the global PHP version that is used by Herd, select it in the dropdown menu in the menu bar.

The selected PHP version will be used for all sites that are not isolated.

#
Via the CLI

If you prefer to use the CLI, you can use the herd use command to switch between PHP versions. This command works the same way as the valet use command. You can read more about it in the Valet documentation.

$ herd use 8.2

#
Per-site PHP versions

By default, Herd will use the global PHP version to serve all your sites. However, if you need to support different PHP versions for different sites, you may use the isolated sites functionality. This configures Herd to use the specified PHP version for the site, regardless of the global PHP version.

#
Via the GUI

You can configure the PHP version to use per site in the "Sites" tab of the preferences window. This gives you a list of all your sites and allows you to configure the PHP version to use for each site.

Just select the PHP version you want to use for the site in the dropdown menu.

#
Via the CLI

If you prefer to use the CLI, you can use the herd isolate command to switch between PHP versions. This command works the same way as the valet isolate command. You can read more about it in the Valet documentation.