Featured

PHP Monitor 5.4 now available

June 28, 2022
Table of Contents

I’m pleased to announce the availability of PHP Monitor 5.4. This new release brings a bunch of new features to the app: both changes under the hood and powerful additions such as presets, or support for custom services.

PHP Monitor 5.4 has gotten some more features. This is what it currently looks like.
PHP Monitor 5.4 has gotten some more features. This is what it currently looks like.

This release took a bit longer to make and includes a set of rewrites under the hood: various views in the app are now being rendered with SwiftUI and should be more responsive.

The way services work have also changed: not only is it easier than ever to start or stop them from the menu, but it is also possible to bring your own Homebrew services to PHP Monitor and manage them from here.

Another big addition are the new configuration presets: you can set up a preset which will apply various configuration values, extensions and even PHP version in one go: it’s very quick!

In this blogpost, I’d like to go over all of these changes.

New Features

Configuration Presets

If you manage different sites, it’s quite possible that you may have various different PHP configuration values set up. Applying those can be done via code, but it is often a good idea to adjust your php.ini configuration file as well.

Prior to this version of PHP Monitor, you would have to manually apply those changes. With this release of PHP Monitor it is possible to declare a preset in PHP Monitor’s config.json file.

Any presets you have defined yourself can be quickly applied.
Any presets you have defined yourself can be quickly applied.

Here’s what one such configuration file might look like:

{
    "scan_apps": [],
    "services": [],
    "presets": [
        {
            "name": "Production Mode",
            "php": null,
            "extensions": {
                "xdebug": false,
                "opcache": true
            },
            "configuration": {
                "error_reporting": "E_ALL & ~E_DEPRECATED & ~E_STRICT",
                "display_errors": "Off",
                "memory_limit": "128M",
                "upload_max_filesize": "128M",
                "post_max_size": "128M"
            }
        },
        {
            "name": "Development Mode",
            "php": null,
            "extensions": {
                "xdebug": true,
                "opcache": true
            },
            "configuration": {
                "error_reporting": "E_ALL",
                "display_errors": "On",
                "xdebug.mode": "coverage",
                "memory_limit": "512M",
                "upload_max_filesize": "512M",
                "post_max_size": "512M"
            }
        }
    ]
}

There are a few things to note about this feature:

  • You can (optionally) specify a PHP version this preset applies to. If you apply the preset, PHP Monitor will attempt to switch to that PHP version before applying any of the extensions and configuration values.
  • You can toggle extensions for a particular PHP installation, but they must be installed or disabled.
  • The preference that needs to be set must exist or it will not be set. For example: if xdebug.mode is not set in any of your .ini files, it will not be added either.

If you have made a mistake and applied a preset accidentally, there is a rollback option via the ‘Revert to a Previous Configuration…’ menu item.

(This will open up a dialog and tell you what values to “restore” and allows you to choose to actually perform this rollback or not.)

Custom Services

In PHP Monitor’s configuration file, you can now specify additional services that can be managed via the app. These must be services made available via Homebrew. You cannot tap into other types of services at this time.

If you specify any Homebrew services, you can see these appear in PHP Monitor.
If you specify any Homebrew services, you can see these appear in PHP Monitor.

You can find out which services are available by running:

brew services list

This will output something like this:

➜  ~ brew services list
Name    Status  User           File
dnsmasq none    root
httpd   none
mailhog started nicoverbruggen ~/Library/LaunchAgents/homebrew.mxcl.mailhog.plist
nginx   none    root
php     none    root
[email protected] none

Please note that there is a limitation in regard to this feature: you cannot run services as root via PHP Monitor. Only use this for services that you intend to run as your own user (e.g. mailhog, as demonstrated above).

Xdebug Integration

If you enjoy using Xdebug, you may want to enable or disable specific modes during development to speed up your development flow.

Note: Xdebug must be configured correctly before this menu item becomes visible. The extension must be installed and the xdebug.mode configuration value must be set (in php.ini or in any other .ini file).

Previously, you would have to manually edit your .ini file, but you no longer need to do so.

You can now choose which Xdebug modes are active.
You can now choose which Xdebug modes are active.

You can also quickly disable all of Xdebug’s modes if you have too many active.

(Take note that the biggest performance improvement comes when you completely disable Xdebug by turning off the extension, which is still an option.)

Quality of Life Changes

Start & Stop Services

Instead of just showing a checkmark or cross, there are now buttons beneath the different services that PHP Monitor uses. You can click on these buttons to toggle the associated services.

Domain List Info Popup

When you click on a PHP version number in the domain list, it will now present additional information about the compatibility of the current PHP version and how that version relates to the domain or site you are trying to serve.

This informational pop-up provides information about PHP constraints and site isolation, if applicable.
This informational pop-up provides information about PHP constraints and site isolation, if applicable.

This informational pop-up provides information about PHP constraints and site isolation, if applicable.

Updated Preferences

Now this is a nice looking Preferences window!
Now this is a nice looking Preferences window!

The Preferences window was getting a bit big, so it now has multiple tabs to make it easier to find what you’re looking for.

Notification Control

For each type of notification that PHP Monitor might send, you can now toggle whether you want to receive them or not.

As you can see, there are now a lot of options to toggle the different types of notification.
As you can see, there are now a lot of options to toggle the different types of notification.

Don’t want to see a particular notification, but all the others are fine? You can now configure it all to your heart’s desire.

SwiftUI

Various views throughout the app have been rewritten and now use SwiftUI. If something looks off, please let me know. If you are on macOS 11, please get in touch and let me know if you encounter issues with the appearance of the app.

Moved Configuration File

The PHP Monitor configuration file has been moved to ~/.config/phpmon/config.json. If you had a custom configuration file before, it will be automatically copied to the new location.

Upgrade instructions

The simplest way to ensure all of your Homebrew taps are up-to-date, and to upgrade PHP Monitor, run:

brew update-reset && brew upgrade phpmon

Please note: running brew update-reset is technically only needed if you are having issues, but it shouldn’t cause any issues if you run it anyway.

Thank You

As usual, my thanks goes out to everyone who sponsored me so far.

Your support keeps me motivated to keep building cool new features, and helps keep the app free for everyone.

PHP Monitor 6 is gonna be wild.
Learn more about how you can sponsor my work.