Skip to content

Isolating PHP Versions

Valet Linux Plus allows you to isolate specific sites to run on different PHP versions without changing the global PHP version. This is particularly useful for maintaining compatibility with older projects or testing different PHP versions.

Isolating a Site

To isolate a site to use a specific PHP version, use the valet isolate command:

valet isolate {phpVersion} --site={siteName} --secure
  • {phpVersion} The PHP version to use (e.g., [email protected], [email protected]).
  • --site= (Optional) Specify the site to isolate. If not provided, the current working directory is used.
  • --secure (Optional) Create a secure (HTTPS) isolated site.

Example

To isolate a site to use PHP 7.4 and secure it with HTTPS:

valet isolate [email protected] --site=example.test --secure

If you are in the site's directory, you can simply run:

valet isolate [email protected] --secure

Listing Isolated Sites

To list all isolated sites along with their isolated PHP versions, use the valet isolated command:

valet isolated

This command will display a list of all sites that have been isolated and the PHP versions they are using.

Removing Isolation

To remove the isolation for a specific site, use the valet unisolate command:

valet unisolate --site={siteName}
  • --site= (Optional) Specify the site to remove isolation from. If not provided, the current working directory is used.

Example

To remove isolation from a specific site:

valet unisolate --site=example.test

If you are in the site's directory, you can simply run:

valet unisolate