Github GitHub - nicoverbruggen/phpmon: Lightweight, native Mac menu bar app that...
source link: https://github.com/nicoverbruggen/phpmon
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
PHP Monitor
If this software has been useful to you, all I ask is that you please star the repository, so I know that the software is being used. You can also send me feedback if the app came in handy.
Thank you!
PHP Monitor (or phpmon) is a lightweight macOS utility app that runs on your Mac and displays the active PHP version in your status bar. It's tightly integrated with Laravel Valet, so you need to have it set up before you can use this.
Screenshot: A menu showing all of the functionality of PHP Monitor.
It's super convenient to switch between different versions of PHP. You'll even get notifications (only if you choose to opt-in, of course)!
PHP Monitor also gives you quick access to various useful functionality (like accessing configuration files, restarting services, and more).
System requirements
PHP Monitor is a universal application that runs on Apple Silicon and Intel-based Macs.
- macOS 10.14 Mojave or higher (works on macOS 11 Big Sur)
- Homebrew is installed in
/usr/local/homebrew
or/opt/homebrew
- The brew formula
php
has to be installed (which version is detected) - Laravel Valet 2.13 or higher
You may need to update your Valet installation to keep everything working if a major version update of PHP has been released.
How to install
You can install via Homebrew, or may download the latest release.
To install via Homebrew, run:
brew tap nicoverbruggen/homebrew-cask
brew install --cask phpmon
To upgrade your existing installation, run:
brew upgrade phpmon
The app is signed and notarized, meaning all you have to do is approve its first launch.
Why build this?
I wanted to be able to see at a glance which version of PHP was linked, and handle dealing with Laravel Valet in a simple app without having to deal with the terminal every time.
Initially, I had an Alfred workflow for this — but it has now been replaced with this utility, which also does a good job at displaying additional information at a glance, like the current PHP version, memory limits, and more.
The app won't start?!
PHP Monitor performs some integrity checks to ensure a good experience when using the app. You'll get a message telling you that PHP Monitor won't work correctly in a variety of scenarios.
Follow instructions as specified in the alert in order to resolve any issues.
FAQ & Troubleshooting
If you are having issues, the first thing you should be doing is installing the latest version of PHP Monitor and Laravel Valet. This can resolve a variety of issues. To upgrade Valet, run
composer global update
. Don't forget to runvalet install
after upgrading.
If you're still having issues, here's a few common issues and solutions:
I want PHP Monitor to start up when I boot my Mac!I want to set up PHP Monitor from scratch! I don't have Homebrew installed either, where do I begin?
brew install php
brew install composer
nano .zshrc
# on an Intel Mac
export PATH=$HOME/bin:/usr/local/bin:$PATH
# on an M1 Mac
export PATH=$HOME/bin:/opt/homebrew/bin:$PATH
export PATH=$HOME/bin:~/.composer/vendor/bin:$PATH
which php
composer global require laravel/valet
valet install
valet trust
PHP Monitor tells me `php` is not installed...
brew install php
brew link php --force
Valet sites won't load. I'm getting a 502 Bad Gateway error!
composer global update
valet install
One of the limits (memory limit, max POST size, max upload size) shows an exclamation mark!One of my commented out extensions is not being detected...I've got two Homebrew installations on my Apple Silicon Mac, can I choose which installation to use with PHP Monitor?Why is the app doing network requests?After running PHP Monitor, Homebrew sometimes has issues with `brew upgrade`!
Having another issue?
I did not include any tracking or analytics software, so if you encounter issues, let me know via an issue.
Support me?
PHP Monitor is available entirely free of charge, but if you can afford it a donation helps keep the project alive and the app maintained.
You can find a sponsor link at the top of this repo or you could click the link here to be taken to my sponsorship page.
Donations really help with the Apple Developer Program cost, and keep me motivated to keep working on PHP Monitor outside of work hours (I do have a day job!).
How it works
Loading info about PHP in the background
This utility runs php -r 'print phpversion()'
in the background periodically. It also checks your .ini
files for extensions and loads more information about your limits (memory limit, POST limit, upload limit).
In order to save power, this only happens once every 60 seconds.
Switching PHP versions
This utility will detect which PHP versions you have installed via Homebrew, and then allows you to switch between them.
This means:
- You have at least the latest version of PHP installed (
php
) - You have installed Laravel Valet (
which valet
returns/usr/local/bin/valet
) - You ran
valet trust
, which means Valet commands can be run without using sudo
The utility runs the following commands:
- Unlink all detected PHP versions
- Switch to whatever version of PHP
php
is at (this is done to ensure that Valet works, even when attempting to use PHP 5.6) - Stop all relevant services (
php
,nginx
) - Link the desired version of PHP
- Start the correct
php
service for the desired PHP version
Want to know more?
If you want to know more about how this works, I recommend you check out the source code.
This app isn't very complicated after all. In the end, this just (conveniently) executes some shell commands.
Build instructions
If you'd like to build PHP Monitor yourself, you need:
- Xcode (usually the latest version)
- The contents of this repository
Once you have downloaded this repository, open PHP Monitor.xcodeproj
, and you should be able to immediately build the app for your system by pressing Cmd-R. This will create a debug build. (If Xcode complains about code signing, you can turn it off.)
If you'd like to create a production build, choose "Any Mac" as the target and select Product > Archive.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK