I've been a PHP developer for quite some time, please no eeewwww PHP remarks. My preferred development machine is a macbook pro. With new releases of PHP coming out on a pretty much regular basis I like to keep my local installation update to date. I also use Xdebug for visual debugging. Here is how I install PHP and keep it up to date.
Assumptions
This post does not cover installing PHP and configuring it with Apache. If you need help with that I suggest taking a look at this post by Andy Miller. He covers pretty much everything and this is the guide I referred to when I did my first install. I also assume you are using Homebrew to manage opensource packages on your mac. You will also need pecl installed. That is covered in Andy's post
Upgrading PHP
$ brew update
$ brew upgrade (to upgrade all packages)
$ brew upgrade php7 (to upgrade only PHP)
Upgrading Xdebug
NOTE: Xdebug updates are a little behind on keeping in sync with the latest PHP7 version. This covers PHP 7.3.3
- Uninstall the previous Xdebug
$ sudo pecl uninstall -r xdebug $ sudo pecl install xdebug
NOTE: It is important that your CLI version of PHP is pointing to the version you want to work with. Pecl will use that version to determine which source to compile and link