PHP version stats: July, 2023
Once again, I'm writing my 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.
As always, it's important to note that I'm working with the data available to us. 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.
# 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:
Visualizing this data looks like this:
Evolution of version usage
It's important to know which PHP versions are currently still supported: PHP 8.2 and PHP 8.1 are still receiving updates. PHP 8.0 is still getting security updates until the end of November, this year. That means that PHP 7.4 and below don't receive any updates more, and should be considered end of life.
In total, that's around 30% of packagist downloads by outdated and insecure version of PHP. At the beginning of this year, that number was closer to 40%, meaning we see a steady decline — a good thing!
Moving on to the all-time overview chart, here you can see the evolution of version usage across time:
All time evolution
It seems that PHP 8.1 saw the biggest growth over time since PHP 7.4 and PHP 5.5. PHP 8.2, in comparison, seems to make a slower start. It's also interesting to note a relative high percentage of PHP 8.1 two years in a row. Granted, PHP 8.1 was a pretty solid release with features like enums and readonly properties. It'll be interesting to see how this graph evolves next year, when PHP 8.1 moves in security fixes only mode.
# Required versions
Next, I used Nikita's popular package analyzer to download the 1000 most popular composer packages. I wrote a script that scans these packages to determine their minimum required version. Here are the results:
There are two important notes to make here.
- 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 or and PHP 8.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
There seems to be a pretty big leap in PHP 8.0 and PHP 8.1 being the minimal versions — a good thing. After all, the open source community plays a big part in pushing the community forward by increasing their minimal required version.
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. You can also subscribe to my newsletter if you want to receive updates about this blog in the future.