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!

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.

PHP CMS’ and which is right for your developer

This article aims to help you in picking which PHP CMS to use for your next project, with advantages and disadvantages to various options.

Introduction

Which Framework or CMS should I use? This is often one of most difficult and controversial decisions to make before you start building a website. This decision after all will affect you for the next few years and picking incorrectly can have huge consequences.

Throughout my career in web development I have come across and used a number of different PHP frameworks and CMS’. As you use them more and more, you build up an understanding of which jobs they are most suited for. In turn this allows you to be able to see which areas they might struggle.

The goal of this article is to describe my experiences of these different frameworks. From this you will hopefully be able to weigh up which one is most suited for a particular job. As a PHP Developer I only have experience working in smaller Web Agencies so I can’t speak for larger ones and in house teams.

Which Frameworks are we comparing?

Whilst writing this article I can only really comment on the frameworks I have used in the past to build sites these are as follows:

  • WordPress
  • Drupal (7 and 8)
  • Craft CMS

WordPress

WordPress backend interface

WordPress Photo from Unsplash (Stephen Phillips – Hostreviews.co.uk)

Let’s start with WordPress, one of the most well known CMS’ around at one point. According to W3 Techs, a company that specialise in Web Technology Surveys, WordPress’ market share of the internet is around 40%.

WordPress’ Advantages

WordPress’ popularity often makes it a go to choice for people wanting a CMS. It is a well known CMS, with plenty of articles and support forums to get help from. These advantages can make it easier to sell to clients. Due to this fact, WordPress has a comprehensive plugin store and vast array of different themes and starter templates.

Another advantage of WordPress is a user friendly admin experience, making it easy for new users to pick up.

WordPress’ Disadvantages

These advantages however do not make WordPress the ideal tool for every client. Whilst WordPress gives you a vast amount of features with the help of plugins, sometimes customers would more bespoke customisation options. This in my opinion is where WordPress is a little lacking when compared to other solutions.

Usually when building a new feature on a WordPress site, you can often find a plugin which will take you 90% of the way to what you need. If you are happy to work around these limitations or compromise on them, WordPress is a great choice. Getting that extra 10% right however is often where some of the fundamental issues of WordPress can occur. WordPress has this reputation where everything is very fast to develop and easy to use. Personally whilst using it for the past year or so I have seen times where this just isn’t the case. Especially when compared to newer CMS’ and frameworks on the market.

The way people perceive WordPress can be another key disadvantage. I think there is this thought that WordPress is easy to learn and build a site with. Whilst I find this partially true in order to build one that performs well, like anything it takes time. I’ve always found it tricky to get good performance scores on WordPress sites, unless it’s rather simple. This is because the more plugins and features you pack into the site, the slower it becomes. Sites only grow overtime adding more features and functions. Keeping this under control with WordPress is difficult as plugins are usually the only feasible way to get extra functionality quickly. You should therefore take the time to consider every change you make and be conservative with what you are doing.

WordPress’ Summary

So what type of project is WordPress good for? Well as I touched on above I can see WordPress being great for blogs or company brochure sites. Whilst other sites can be creating using tools like WooCommerce, I often find these sites suffer performance issues and are tricky to get right. E-Commerce sites often require large, customised features that I think are implemented better using more focused feature sets.

WordPress can be a good tool if your client is focused on key functionality but is open to accept a few compromises.

Whilst WordPress is customisable, it lacks some key features when compared to other CMS. This lack of features often makes it harder and more time consuming to develop bespoke functionality for.

Drupal

Drupal Backend Admin Interface
Drupal admin area

Drupal is the framework which I have most experience with. At first there were a few things that I found awkward and difficult. This is commonly referred to in the community as “the Drupal learning cliff”. Its approach and target audience is slightly different to WordPress’ in my opinion. It’s more aimed at site builders and has a large number of tools to support the structure and pages for a website.

The community is more aimed at being fully open sourced and you will very rarely if not ever, come across a module which the developer charges for.

Drupals Advantages

As a developer looking at Drupal I think it’s more of a framework with a CMS integrated. This is perhaps the biggest difference between it and WordPress. You have a greater number of available API’s when compared to WordPress to assist developers in doing common tasks. A few examples of these are giving more control over frontend registration, registering new tables (or entities) and giving you the ability to setup new fields to allow you to build a site of any type without any extra modules or plugins.

Another key advantage is the open source nature of its module system. This promotes a community where new features and bug fixes can be submitted by anyone. Meaning that code isn’t abstracted away or has that reliance on another company to support it.

Drupals Disadvantages

The main disadvantage I found was its learning curve. After spending a fair amount of time with it I think there are still things which confuse me about it. I found that it caused me issues whilst theming a particular element. It can be difficult, confusing and feel like Drupal can get in the way of this since you always need to conform to its standards.

Due to this it can be rather complicated and I have often found certain aspects of its theming system to get in the way and make a job more time consuming.

Drupal Summary

What type of site is Drupal good for? Well this is a tricky one, I find that it has a large number of features and modules to assist with building any website imaginable. I find that with those features built into core, performance issues can be a lot less rare. If you have little experience with it, there are still considerations to be made which can impact performance.

In my experience the Commerce module works very well. It can be a great choice if you want to get a site together quickly. Where I think it can be tricky is when you want a more customised experience. Like WooCommerce, Drupals Commerce module can make a lot of assumptions about how you want your site to function. If you are however happy and willing to make some compromises, it can be a good option.

If Drupal isn’t something you are familiar with take it slow, play with it a little and see some of the key benefits you can find with it. In comparison to WordPress, it is much more of a framework than a CMS. Once you get used to that, achieving the task at hand can be much faster due to its larger set of useful API’s or helper functions.

The key downsides to the framework is that because it is aimed at site builders, the CMS can feel cluttered and not friendly to users. In order to reduce that for normal site users, it can take time and care. I’ve noticed people say that the backend CMS is often a lot more daunting and confusing. So be prepared to be writing more documentation and assisting a client with content and site administration.

Craft CMS

Craft CMS backend screenshot
Happy Lager Craft Demo site backend.

Recently I’ve been diving into building sites within Craft. At first I wasn’t too sure about it. When working in an agency where speed is often key, I thought the lack of a theming system would slow the development process down. After speaking to some of the frontend team though, they see this as a huge advantage.

Craft CMS Advantages

is its simple user interface and mix of tools to allow you to build a site with specific requirements.

As I touched on in the above paragraph, one of the main advantages of Craft is that it allows a developer to have full control over the markup. This can be hugely advantageous and allow you to build a site with less restrictions.

I really like this in Craft and feel this is one of its greatest strengths. Of course with these strengths come weakness’ too.

Craft CMS Disadvantages

Unfortunately Craft has the least amount of plugins and a much smaller community backing it. This means that if there isn’t a plugin to achieve a specific requirement, you’ll unfortunately have to build it from scratch. It also means that when you encounter an issue, it’s much more difficult to find a solution for it.

Craft is also the only CMS in this list which you need to pay for in order to use. Whilst I feel like the cost is honestly worth it, I have to put it as a disadvantage when compared to other CMS’ on this list.

Finally due to the smaller community and lack of articles, it can take a lot longer to find the answer you need. A lot of the time this means I have to go through the source code of Craft with XDebug to look at how it works.

Craft CMS Summary

So what is Craft great for? I see Craft as an option which will take a lot more time to get the features you like but the lack of a theming system can be used to your advantage. Sites can be build with completely custom markup allowing the freedom and flexibility to build something with unique requirements. Simple brochure sites built in Craft can often take less time due to this but as feature sets of these sites increase, it can take much longer to build backend components with, when compared to other options on this list.

Craft has a much more modern approach to development than WordPress. Because of this, it’s great that you can easily reach for composer libraries speed up development time.

I get the feeling after using Craft for a while, it’s aim to to give you a CMS and framework to allow you to build bespoke websites the way you would like to. It tries not to make too many assumptions on how you should build your site. Depending on how you look at it this is either a good thing or bad. I’d say if you have a client with very bespoke requirements, Craft might be a great tool for the job, at the expense of it potentially taking a lot longer, especially for a backend developer.

Conclusion

To conclude, there isn’t really a single CMS or Framework that will fit every need or that is absolutely perfect. But I hope that this article might help you pick a better fit for your next site. If you have anything to add or disagree with any of my points, pop them in the comments below.