It's that time of the year again, where I figure it's time to update my yearly data on PHP version usage. Last year's post showed 5.5 as the main winner and 5.3 declining rapidly. Let's see what 2015 brought.

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 GET /packages.json which represents a composer update 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. Of course this data set is probably biased towards development machines and CI servers and as such it should also be taken with a grain of salt.

PHP usage statistics

I have two datasets, from November 2014 and today, which shows the progression of various versions. Any version below 3% usage has been removed to keep things readable.

November 2014

All versions Grouped Total 11556916 100.00% Total 11556916 100.00% PHP 5.5.9 2475970 21.42% PHP 5.5 5647892 48.87% PHP 5.4.4 1022498 8.85% PHP 5.4 3305929 28.61% PHP 5.5.17 678997 5.88% PHP 5.3 1716653 14.85% PHP 5.5.16 529227 4.58% PHP 5.6 886260 7.67% PHP 5.3.3 509101 4.41% PHP 5.3.10 479750 4.15% PHP 5.6.0 391633 3.39%

November 2015

All versions Grouped Total 14539303 100.00% Total 14539303 100.00% PHP 5.5.9 4307667 29.63% PHP 5.5 7368033 50.68% PHP 5.6.14 818735 5.63% PHP 5.6 3211919 22.09% PHP 5.3.3 669327 4.60% PHP 5.4 2305984 15.86% PHP 5.4.45 573003 3.94% PHP 5.3 1439061 9.90% PHP 5.6.13 492995 3.39% PHP 7.0 169411 1.17%

And here are pretty pies thanks to Ashley Hindle

A few observations: 5.3 lost 5% which is good but now I guess we are on a long tail decline of Ubuntu 12.04 machines, plus a lot of libs still test against it on Travis which might bias the numbers a bit. 5.5 is still the major platform with a stable 50%, and 5.6 adoption gained 15% that were lost by 5.4. We also see 7.0 appearing slowly, mostly I assume from travis builds again.

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 - November 2015 (+/- diff from November 2014)

5.2 1367 2.78% (-0.8%) 5.3 25376 51.69% (-16.17%) 5.4 16418 33.45% (+7.04%) 5.5 5002 10.19% (+8.18%) 5.6 826 1.68% (+1.54%) 7.0 99 0.2% (+0.2%)

A few observations: 5.3 lost quite a bit of ground but it seems to go to both 5.4 and 5.5. Given that 5.4 usage is going down quite a bit I think it's safe to go from 5.3 to 5.5 directly if you are going to bump the version requirement, or I'd even argue for 5.6 as it's usage is going up quite strongly and Ubuntu 16.04 should help that as well.

I think php 7 should be required more as well as it comes with quite a few nifty features, I would say it is a good target for a new major version of any lib, but more on that in another post.