The best way to develop PHP websites locally on MacOS

Over the past few years I’ve been on a quest to find my perfect Local Development stack. I finally found it!

coffee writing computer blogging

Introduction

When you look into the grand scheme of things, web development is still a fairly new industry. It’s only been a consumer thing for a few decades and we are very much in an age where things are moving rapidly. For web developers you could argue that it’s gotten easier to build a website over time. However the tools we use and newer workflows seems to have made things much more complicated.

I’ve been working as a developer professionally now for over 8 years and there have been a whole host of new frameworks tools and evolutions within that space of time. Over the past year or so I’ve been looking into making my development workflow simpler and leaner. During this time I’ve experimented with a number of different solutions. Rather than keep those to myself I thought I’d share my experience with each one and weigh up the pros and cons.

Before I start a little disclaimer

Before I get down to the nitty gritty of what I’ve used, new tools come out each day along with new ways of working. Over the past year or so I have been trying to find something that fits in with my personal workflow and provides the best support for the tooling I require on my day to day basis. This is just my opinion and I’m keen to hear your thoughts and favourite tools in the comments below.

AMPPS

A few years ago AMPPS was my go to piece of software for developing locally. It had a web based UI akin to XAMPP and MAMP and was rather customisable. It had support for a number of different PHP versions and had the ability to easily configure and switch between them on a site by site basis.

What I really liked about it was its ability to configure PHP and over time I began feel familiar and confident with it.

Starting in around 2018 – 2019 however AMPPS has been very slow in getting updates out to support some of the more recent versions of MacOS. Currently the app is not working on MacOS Big Sur with forum posts going back to last July requesting support for it. It currently only supports PHP 7.3 with no easy way of allowing other PHP versions to be installed. We have a number of sites which use different versions of PHP so this doesn’t well work for us.

MAMP / MAMP Pro

Back in the day when I first got into Web Development MAMP was a pretty popular tool. It leans heavily on simplicity and allowed you to get local sites up and running in a few minutes.

It had a user friendly dashboard and allowed you to do handy things like switch PHP and Database Versions pretty quickly.

I recently gave this a go earlier in the year and found myself feeling a little disappointed with it. The app and database kept crashing on my 13″ 2017 MBP to a point where I had 5 in one day. Rather than mess around and spend a few hours trying to get to the root cause of the issue, I got my refund for my MAMP Pro License and proceeded to find another alternative.

Brew Packages

After the issues I encountered with AMPPS I decided to take a look at just installing native brew packages on my Mac. This is perhaps the most customisable way of setting up a development environment. You have fine grain control over every piece of software in the stack and can upgrade and change them however you see fit. This guide written by the guys over at Grav is one of the most comprehensive and recommended ways of getting it setup.

One of my biggest gripes with this method however is just how involved and long winded the setup process can be. Setting up new sites can be a bit more difficult than other process’ too and you need to have some basic knowledge of apache in order to do it. It is however a great learning experience for new people to web development but for more junior developers, it feels quite involved.

For someone with more experience though I think this is one of the goto ways of running PHP sites on localhost. It’s fast, customisable and ticks a large number of boxes for development.

DDEV

DDEV is currently I am using to develop locally. I’ve been using it now for around 4 months or so and I have to say, I’m extremely impressed with it. DDEV ships with all of the tools you would need to develop websites right out the box. Difficult things like SSL Certificates, Mailcatchers and PHP Version Switching is all taken care of within its ecosystem.

DDEV projects need 4 questions initially before a site can be setup with it. Behind the scenes it creates sites within docker containers and uses a CLI tool with a very readable set of commands that just make sense. The one major downside of this tool over the other methods in this list is that Docker containers are obviously slower vs running it on physical hardware and tend to eat a lot more memory. Overall though for me, those two downsides are massively outweighed by just how easy DDEV is to get up and running and how customisable it is.

Leave a Reply

Your email address will not be published. Required fields are marked *