PHP Versions Stats - 2017.2 Edition

Jordi Boggiano • November 13, 2017

news php

It's stats o'clock! See 2014, 2015, 2016.1, 2016.2 and 2017.1 for previous similar posts.

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 month 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

November 2017 (+/- diff from May 2017)

All versions Grouped
PHP 7.1.10 11.63% PHP 7.1 36.63% (+18.99)
PHP 7.0.22 7.95% PHP 7.0 30.76% (-5.36)
PHP 5.6.31 7.38% PHP 5.6 23.28% (-8.16)
PHP 5.6.30 7.23% PHP 5.5 6.11% (-4.5)
PHP 7.0.24 5.45% PHP 5.4 1.51% (-1.6)
PHP 7.1.11 4.55% PHP 5.3 0.76% (-0.22)

A few observations: I find it quite incredible that PHP 7.1 is now the most used version, even though Ubuntu LTS does not yet ship with it. I don't know if it means people use Docker or alternative PPAs but regardless it is good news! For the first time since I started these blog posts, the version usage actually matches the order in which they were released, with the older ones having less and less usage. That's also great news. We have a total of 90% of installs done on PHP versions that are still maintained, which is awesome. If you are still on 5.6 or 7.0 though you only have one year of security fixes left so consider upgrading to 7.2 which should come out in the next week or two.

Here is the aggregate chart covering all my blog posts and the last four years.

PHP requirements in Packages

The second dataset is which versions are required by the PHP packages present on packagist. I only check the require statement in their current master version to see what the latest requirement is, and the dataset only includes packages that had commits in the last year to exclude all EOL'd projects as they don't update their requirements.

PHP Requirements - Recent Master - November 2017 (+/- diff from Recent Master May 2017)

5.21.28% (-0.24)
5.318.75% (-4.4)
5.420.29% (-4.12)
5.519.07% (-4.63)
5.620.4% (3.59)
7.014.85% (6.12)
7.15.32% (3.65)
7.20.03% (0.03)

This moves at a decent pace with EOL'd versions slowly being abandoned. I still think it could go faster though ;) Please consider bumping to PHP 7.0 at the very least when you update your libraries.