😴 I'm taking a break from February 1, 2024 until May 12, 2024, so I will be less active here and on social media.

Featured

PHP Monitor 5.2 now available

March 29, 2022
Table of Contents

I’ve just released PHP Monitor 5.2 with various new features, performance improvements and bug fixes.

This release comes with a reworked domains list window and has support for Laravel Valet 3.0. As such, PHP Monitor now also supports site isolation. That’s a big deal and if you read on you can find out why that is the case.

The new promotional screenshot for PHP Monitor 5.2, showing off site isolation and the reworked domains list window.
The new promotional screenshot for PHP Monitor 5.2, showing off site isolation and the reworked domains list window.

As usual, my thanks goes out to the various beta testers who provided feedback and reported bugs for this release, and I very much appreciate those who have donated money to support the project.

New Features

Updated domains list

New table-based UI

The domains list now sports a table-based UI: You can rearrange the contents of the table based on the various columns that have been made available.

The new promotional screenshot for PHP Monitor 5.2, showing off site isolation and the reworked domains list window.
It is perfectly possible to rearrange the various columns in the domains list, like this.

You can also rearrange the columns. The order and sorting is remembered, so you only have to set it once.

Which PHP is being used right now?

If you examine the panel, you’ll note the Active column behaves a bit differently from before. The active PHP version displayed is the version that is currently used to serve the domain.

This used to be the target PHP version, as defined in composer.json. You’ll see this value change if you have isolated the site. The PHP version requirement as declared in your project can be found under the Project Type column, below the type of project.

Isolation via right-click

The new promotional screenshot for PHP Monitor 5.2, showing off site isolation and the reworked domains list window.
How simple it is to isolate a site, once you have PHP Monitor 5.2 installed alongside Valet 3.

You can select a domain, and open the context menu (right-click) to isolate a domain. This allows you to pick a fixed version to be used for that domain. You will need to have Valet 3 installed for this feature to be enabled.

Valet 3 support

Status of Valet 2 support

This release introduces support for Valet 3, which comes with some delightful new features, but also drops support for PHP 5.6.

Since some of you might need access to PHP 5.6, this release obviously still supports Valet 2 as well, but the available features in PHP Monitor will differ based on which version of Valet you are running:

Feature Availability Valet 2.21+ Valet 3.0+
Switch Global PHP ✅ ✅
PHP 8.2—PHP 7.0 ✅ ✅
PHP 5.6 ✅ 🚫
Domain Linking ✅ ✅
Domain Secure (TLS) ✅ ✅
Domain Isolation 🚫 ✅

Upgrading to Valet 3

If you would like to make use of the new version of Valet, you must first update the version constraint in your global composer.json file:

"require": {
    "laravel/valet": "^3.0",
    (...)
}

Upgrade your global dependencies:

$ composer global update

And upgrade Valet, by running:

$ valet install

Default site support

If you have a default site set up in your Laravel Valet config.json file, this site will now show up in the domains list.

Easy CLI access to various PHP versions

PHP Monitor 5.2 can make it easier for you to run terminal commands using a specific version of PHP.

Since you can now force specific sites to use a particular version of PHP, sometimes you’ll need to run a command with that version of PHP, too.

PHP Monitor registers these helpers for you, assuming you are permitted to write to the /usr/local/bin folder. Make sure you own the folder first, or the helpers will not be created:

sudo chown "$(whoami)" /usr/local/bin

After doing that, restart PHP Monitor.

Here’s how you can use these helpers. First, I recommend you check which version is globally linked:

$ php -v
PHP 8.1.4 (cli) (built: Mar 18 2022 09:32:37) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
    with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans

This is the globally linked PHP version. Now, let’s say we want to use PHP 8.0 in this terminal, from now on. We can source the pm80 helper in that case. (If we wanted PHP 7.4, we’d use pm74.)

You can use the shorthand for source, which is .:

$ . pm80
PHP Monitor has enabled this terminal to use PHP 8.0.

The script includes a little notice, so you’ll be able to see that it worked.

Alternatively, you can run source pm80 as well. Any subsequent commands in this particular terminal session will run with that version of PHP, so keep that in mind:

$ php -v
PHP 8.0.17 (cli) (built: Mar 18 2022 09:32:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.17, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.17, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

If you run composer update now, it’ll use that version of PHP as well. You can close the terminal you have active and open a new terminal to switch back to the globally linked PHP version.

If you’d like to inspect these helpers, you can find them in /usr/local/bin for every PHP version that is available on your system. They are overwritten whenever the app boots.

General improvements

I was able to track down a minor bug in how some tasks were delegated to background threads, and discovered a performance issue. This has been resolved, and PHP Monitor should open faster than ever before.

(Especially opening the menu for the first time should no longer be subject to slight stuttering or judder. It was really bothering me so I hope you’re all happy too.)

Upgrade instructions

If you want to, you can upgrade to Valet 3. (This will enable site isolation but disable PHP 5.6 support in PHP Monitor, so choose based on your requirements.)

brew upgrade phpmon

If you are having issues, you can run brew update-reset to ensure Homebrew’s package information is up-to-date with the latest on GitHub.

Bottom Line

PHP Monitor 5.2 comes with a variety of improvements. You can find the complete changelog on GitHub. I hope you this release ends up being useful.

Oh, and if you haven’t done so yet, please consider sponsoring me. Since starting work on PHP Monitor in 2019, I’ve spent more than 200 hours coding and supporting this project and I’m still not charging for it! 😙