PHP version stats: July, 2024

Every six months, I do an update on which PHP versions are used across the community. You can read the previous edition here, I'll also include historic data in this post.

Keep in mind note that I'm working with the data available. That means that these charts are not a 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.

This blog post was sponsored by Private Packagist - the private Composer repository from the creators and maintainers of Composer & Packagist.

# Usage Statistics

As usual, we start by looking at the percentage of PHP versions being used today, note that I've omitted all versions that don't have more than 1% usage:

Version 2023-01 2023-07 2024-01 2024-07
7.2 4.3% 4.3% 2.5% 2.0%
7.3 5.3% 4.2% 3.2% 1.9%
7.4 27.7% 19.9% 13.6% 10.2%
8.0 16.2% 12.3% 7.2% 5.4%
8.1 38.8% 39.3% 35.2% 26.1%
8.2 4.7% 17.2% 29.4% 32.3%
8.3 0.0% 0.2% 6.4% 19.9%

Visualizing this data looks like this:

Evolution of version usage

An additional data point I wanted to look into this time, is to compare the growth of each PHP version the first half year after its release.

Version 6 month adoption rate
7.0 19.0%
7.1 16.2%
7.2 12.4%
7.3 19.8%
7.4 17.1%
8.0 9.2%
8.1 15.4%
8.2 12.5%
8.3 13.5%

What's interesting is that the PHP 7.* versions seem to have had a faster adoption rate compared to PHP 8.* releases. From a personal point of view, I also feel less need to immediately update to newer PHP versions, especially since they didn't offer that many exciting features the past two years. I wonder if the adoption rate for PHP 8.4 will be higher or lower, especially since it has some very nice features (like property hooks).

Let's take one more look at version evolution across time, you can spot the slowed down adoption rate in this chart as well::

All time evolution

# Required versions

Next, I used Nikita's popular package analyzer to download the 1000 most popular composer packages. I use a script that scans these packages to determine their minimum required version. Here are the results:

Version 2023-01 2023-07 2024-01 2024-07
5.2 10 7 7 5
5.3 78 65 58 50
5.4 40 31 28 26
5.5 37 21 16 15
5.6 43 32 30 29
7.0 30 24 24 24
7.1 159 125 100 93
7.2 144 133 123 118
7.3 106 56 49 42
7.4 98 97 87 80
8.0 103 144 126 123
8.1 129 107 154 184
8.2 - 94 135 153
8.3 - - 0 4

There are two important notes to make here.

  1. This tables shows the minimum required version. That means that packages with a minimal version of, for example, 8.0, could also support PHP 8.1, PHP 8.2, and PHP 8.3.
  2. If you count the numbers, you'll notice there are some differences between each year. Not every package lists a valid version string.

This blog post was sponsored by Private Packagist - the private Composer repository from the creators and maintainers of Composer & Packagist.

Instead of comparing absolute numbers, it's best to plot this data into a chart for a relative comparison, so that we can see changes over time:

Minimal PHP requirement over time

We see the first four packages requiring PHP 8.3 as their minimal version this month, however there is a huge difference compared to PHP 8.2 and PHP 8.1, which had 94 and 125 packages using them as their minimum version respectively. Granted, PHP 8.3 has been a rather boring release, with quite a lot of deprecations as well, but I didn't expect the difference to be so big. We'll see how and if this trend continues in the next year with PHP 8.4.

Once again, I'd like to remind open source authors about the responsibility we collectively hold to move the PHP ecosystem forward. Bumping minimum requirements is a good thing to do, and should — in my opinion — but done more and faster. Feel free to disagree and share your thoughts via email or in the comments below this post.

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 subscribe to my mailing list: send an email to brendt@stitcher.io, and I'll add you to the list.