PHP Versions Stats - 2016.1 Edition

Last year I posted stats about PHP versions, and the year before as well, both time in November. However this year I can't wait for November as I am curious to explore the PHP7 uptake!

A quick note on methodology, because all these stats are imperfect as they just sample some subset of the PHP user base. I look in the logs of the last 28 days for Composer installs done by someone. Composer sends the PHP version it is running with in its User-Agent header, so I can use that to see which PHP versions people are using Composer with.

PHP usage statistics

I have two datasets, from November 2015 and today, which shows the progression of various versions. Note that the previous dataset was checking for Composer updates only, while the new one includes installs as well.

November 2015

All versions Grouped
PHP 5.5.9 29.63% PHP 5.5 50.68%
PHP 5.6.14 5.63% PHP 5.6 22.09%
PHP 5.3.3 4.60% PHP 5.4 15.86%
PHP 5.4.45 3.94% PHP 5.3 9.90%
PHP 5.6.13 3.39% PHP 7.0 1.17%

May 2016

All versions Grouped
PHP 5.5.9 11.87% PHP 5.6 39.67%
PHP 7.0.6 10.39% PHP 5.5 29.56%
PHP 5.6.20 8.41% PHP 7.0 20.24%
PHP 5.6.21 7.69% PHP 5.4 7.64%
PHP 5.6.19 4.71% PHP 5.3 2.43%

A few observations: 5.3 dropped to almost nothing which is great news! 5.4 is also down by almost 10% and is definitely on the way out. 5.5 is still big but less so, while 5.6 got a huge boost to become the main version. The big surprise is that we have 20% of PHP7 already! That is great news only six months after this major release came out.

PHP requirements in Packages

The second dataset is which versions are required by all the PHP packages present on packagist. I only check the require statement in their current master version to see what the latest is.

PHP Requirements - Current Master - May 2016 (+/- diff from November 2015)

5.2 2.51% (-0.3)
5.3 45.26% (-6.43)
5.4 31.69% (-1.76)
5.5 15.48% (+5.29)
5.6 3.52% (+1.84)
7.0 1.54% (+1.34)

A few observations: 5.3/5.4 are declining slowly, 5.5 is taking the bulk of it though which makes me a bit sad :) I wish there was more love for 7 now that it shipped in Ubuntu 16.04.

All in all, it seems like package requires are way behind actual version usage, so I would like to encourage everyone to be a bit more aggressive in bumping PHP requirements when tagging new major releases of their libs. Don't forget that the old code does not go away, it's still there to be used by people using legacy PHP versions.

June 06, 2016 // PHP

Post a comment

Subscribe to this RSS Feed Comments

2016-06-08 06:15:29

Rasmus Schultz

Why would I bump package requirements for packages that still work on older versions? Doesn't make sense. All of my packages are tested continuously with PHP 7, so they support it, but they don't require it - you count those as PHP 5.x packages, which is false, so your statistic isn't very good, and we shouldn't fix that by locking out those who can't upgrade to 7 yet.

A much better statistic would be based on CI configuration files, or actual CI server usage - maybe you could approach TravisCI, for example, and figure out how many packages are being tested with 7? That's a meaningful statistic. IMO, the number of packages requiring 7 as a minimum is likely to stay small for quite some time - I am not likely to go back and make arbitrary changes to packages that work fine, to make use of PHP 7 features that I don't pressingly need.

With that said, many of our new projects will target 7 directly, because it's a better language to work in - but we will likely leave a lot of perfectly functional packages as they are, because they have already been written. With new work, it's different. At least for me it is :-)

2016-06-08 10:00:15


@Rasmus: My statistics aren't wrong, they just don't say the same thing you are saying. I am not saying only 1% of packages are PHP7 compatible, I am saying only 1% require it. Figuring out what can run on PHP7 isn't really worth the time IMO, I am pretty sure most of the ecosystem works on 7, at least the packages that are still maintained. As for bumping requirements for the sake of it, well I'd rather bump it and be able to use new features than leave it at 5.3 forever because that's good enough. The old tags are still there for people stuck on old PHP they can also be stuck on old dependencies. And you can still maintain the old branch if needed - I sure will maintain 1.x on monolog for a while. But moving forward means we encourage everyone to use newer PHP releases and therefore everyone gets more used to upgrading more regularly, which would benefit us all.

2017-03-25 15:31:00


And this year in 2017 ;-)