Skip to content

Supporting pre release versions of PHP

Nico Verbruggen edited this page Sep 5, 2022 · 8 revisions

First, you'll want to make sure that the pre-release version of PHP is actually supported.

You can check the source file and see what version that is. At the time of writing, PHP 8.2 is the pre-release version that is scheduled to be released later this year.

Then, you'll want to ensure you have the correct tap installed (it should have been installed when you ran valet install) but let's manually ensure that this happened:

brew tap shivammathur/php

Then, you'll want to install e.g. PHP 8.2:

brew install [email protected]

Depending on which versions Valet you have installed, you may need to tweak a source file in your local Valet installation (in ~/.composer/vendor/laravel/valet/cli/Valet/Brew.php). If [email protected] is not listed in the array, add it:

const SUPPORTED_PHP_VERSIONS = [
        'php',
+       '[email protected]',
        '[email protected]',
        '[email protected]',

After this, you should close PHP Monitor and run:

valet install

Depending on how many secured domains you have, you'll have to enter your password a couple of times (or use Touch ID).

Then, start up PHP Monitor again. It should now list the pre-release version of PHP!

I recommend switching globally to PHP 8.2. Try it out in the command line, and then go back to PHP 8.1 as the global version. You can use site isolation to test PHP 8.2 with specific sites.

The helper . pm82 should also work correctly, if you want to invoke PHP 8.2 on the command line, while remaining on PHP 8.1 globally.

$ . pm82
PHP Monitor has enabled this terminal to use PHP 8.2.
$ php -v
PHP 8.2.0-dev (cli) (built: Sep  5 2022 00:36:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.0-dev, Copyright (c), by Zend Technologies
Clone this wiki locally