PHP version stats: January, 2024

It's time for another version stats post! This is my biyearly summary of which PHP versions are used across the community. You can read the previous edition here, but 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

Let's start with the percentage of PHP versions being used today, and compare it to the previous three editions, note that I've omitted all versions that don't have more than 1% usage:

Version 2022-07 2023-01 2023-07 2024-01
7.1 1.9% 1.8% 1.3% 1.0%
7.2 5.1% 4.3% 4.3% 2.5%
7.3 8.0% 5.3% 4.2% 3.2%
7.4 38.4% 27.7% 19.9% 13.6%
8.0 20.6% 16.2% 12.3% 7.2%
8.1 24.5% 38.8% 39.3% 35.2%
8.2 0.0% 4.7% 17.2% 29.4%
8.3 0.0% 0.0% 0.2% 6.4%

Visualizing this data looks like this:

Evolution of version usage

There seems to be a slightly faster adoption of PHP 8.3 compared to PHP 8.2: 6.4% of projects are using PHP 8.3 within the first two months of its release, for PHP 8.2 it was 4.7%.

Furthermore, the PHP 7.* share continues to shrink — a good thing given that support for the 7.* series ended more than a year ago. Right now PHP 8.1 is the oldest supported version, only receiving security updates until November 25 this year. I can't help it, I keep saying the same thing over and over again, it's important update your PHP installations!

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

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 2022-07 2023-01 2023-07 2024-01
5.2 10 10 7 7
5.3 77 78 65 58
5.4 40 40 31 28
5.5 35 37 21 16
5.6 42 43 32 30
7.0 29 30 24 24
7.1 153 159 125 100
7.2 130 144 133 123
7.3 104 106 56 49
7.4 86 98 97 87
8.0 94 103 144 126
8.1 125 129 107 154
8.2 - - 94 135
8.3 - - - 0

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.

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

Talking about progression, I'd like to remind open source maintainers about the power and responsibility they hold. Imagine if all modern open source packages only supported PHP versions that were actively worked on. My suspicion is that many more projects would be encouraged to update faster; eventually leading to a healthier, more performant, and more secure ecosystem. Open source maintainers yield quite a lot of power in this regard.

Also keep in mind that forcing a new minimal PHP requirement doesn't automatically block older projects from using your code: outdated projects can still download older versions of your packages, so there's really no good argument not to do it from a package maintainer's point of view.

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

That's all data I have to share for this edition of PHP's version stats. You can always reach me via email if you want to share your thoughts or have questions.

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.