PHP version stats: July, 2022

It's that time again: my biyearly summary of which PHP versions are used across the community. I know I'm a little early, that's because I had some spare time today and wanted to make sure I got it ready in time. You can read the January edition here.

As always, it's important to note that I'm working with the data available to us. That means that these charts are no 100% accurate representation of the PHP community as a whole, but they are an accurate representation of one of the most prominent parts of PHP: the packagist ecosystem.

# Usage Statistics

Let's start with the percentage of PHP versions being used today, and compare it to the previous two editions:

Version July, 2021 (%) January, 2022 (%) July, 2022 (%)
8.1 0.1 9.1 24.5
8.0 14.7 23.9 20.6
7.4 46.8 43.9 38.4
7.3 19.2 12.0 8.0
7.2 10.4 6.6 5.1
7.1 3.8 2.4 1.9

Note that I've omitted all versions that don't have more than 1% usage. Visualizing this data looks something like this:

Evolution of version usage

As expected during a year with a minor release instead of a major one: PHP 8.1 is growing, and PHP 8.0's usage is already declining. A good sign that developers are updating! Keep in mind that PHP 8.0 is still actively supported for another four months. So if you kept off on updating to PHP 8.1, now is a good time.

Less good news — although not unexpected: more than 50% of developers are still on PHP 7.4 or lower. That's not an insignificant number, considering that PHP 7.4 only receives security updates for 5 more months, and all older versions simply aren't supported anymore.

I did hope to see PHP 8.X adoption to be climbing more rapidly, I've shared some of my thoughts about it here, if you want some more reading.

Check out my latest video:

PHP in 1 minute

PHP in 1 minute

Moving on the the all-time overview chart, here you can see the evolution of version usage across time:

All time evolution

It's interesting to compare the 5.5 peak in 2014 to the 7.4 peak two years ago. PHP 5.5 and subsequent versions saw a much faster decline as soon as PHP 7.0 became available, compared to PHP 7.4's decline when PHP 8.0 was released. I'm a little worried that PHP 8.0 wasn't as exciting as PHP 7.0 back in the day.

Fear for upgrading shouldn't be a blocker these days compared to eight years ago: we now have mature tools like Rector and PHP CS that take care of almost the whole upgrade path for you.

So why aren't people upgrading to PHP 8.0? Why are more people staying with PHP 7.4 compared to the 5.5 and 5.6 days? I don't have a definitive answer.

# Required versions

Part of the answer though (I think) lies with the open source community: what are packages requiring as their minimal version? Are they encouraging their users to update, or not?

I used Nikita's popular package analyzer to download the 1000 most popular composer packages. Next, I used a little script to get the lowest version each package supports from their composer.json file. Here are the results:

Version July, 2021 (#) January, 2022 (#) July, 2022 (#)
8.1 - - 125
8.0 117 160 94
7.4 56 69 86
7.3 133 116 104
7.2 142 133 130
7.1 182 190 153
7.0 31 29 29
5.6 61 49 42
5.5 43 42 35
5.4 41 43 40
5.3 97 83 77
5.2 12 10 10
5.0 2 2 1

I have mixed feelings about this data. On the one hand it's good to see PHP 8.1 as the minimum required version for 125 packages. However, look at how many packages still require a version lower than PHP 8.0: 707 out of 926 packages analysed. That's more than 75%!

Oh, as a side note: there only are 926 packages because some of the 1000 most popular packages don't specifically require a PHP version.

Let's plot this data into a chart:

Minimal PHP requirement over time

I won't say that the open source community is the only responsible factor here, but I do want to encourage you to think carefully about your responsibilities if you are an open source maintainer. We're not just talking about new and shiny PHP features here: we're talking about performance, software security for the most popular programming language on the web, and even about the impact of old PHP versions on electricity usage and server requirements, in Rasmus' words we can help save the planet.


What are your thoughts on these stats? Are you already using PHP 8.1? Let me know your thoughts on Twitter and subscribe to my newsletter if you want to be kept up-to-date about these posts!

Noticed a tpyo? You can submit a PR to fix it. If you want to stay up to date about what's happening on this blog, you can follow me on Twitter or subscribe to my newsletter: