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 packagist.org 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.