Skip to content

Supporting pre release versions of PHP

Nico Verbruggen edited this page Nov 22, 2024 · 8 revisions

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

Determining support

You can check the source file and see what pre-release version is supported.

At the time of writing, PHP 8.5 is the pre-release version that is scheduled for release in 2025, and it is supported by PHP Monitor 7.1.

Installing PHP pre-release

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.5:

brew install [email protected]

Tweaking Valet

The version of Valet you have installed may not support PHP 8.5.

Depending on which version of 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]',
        '[email protected]',
        '[email protected]',

Continue with the guide like before.

Finalizing

After installing the new PHP version and ensuring Valet is compatible with this version, 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!

Nico's Recommendation

I recommend switching globally to PHP 8.5 to test if it works correctly, and switching back to the stable version afterward.

You can use site isolation to test PHP 8.5 with specific sites.

The helper . pm85 should also work correctly, if you want to invoke PHP 8.5 on the command line, while remaining on PHP 8.4 globally.

$ . pm85
PHP Monitor has enabled this terminal to use PHP 8.5.
$ php -v
PHP 8.5.0-dev (cli) (built: Nov  X 20XX 00:XX:XX) (NTS)