PHP Versions Stats - 2017.2 Edition

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.2 1.28% (-0.24)
5.3 18.75% (-4.4)
5.4 20.29% (-4.12)
5.5 19.07% (-4.63)
5.6 20.4% (3.59)
7.0 14.85% (6.12)
7.1 5.32% (3.65)
7.2 0.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.

November 13, 2017 // News, PHP

Post a comment

Subscribe to this RSS Feed Comments

2017-11-13 10:03:42

Lasse Rafn

Lovely!

After seeing the PHP Requirements, I'm going to ditch 5.6 support for good.

2017-11-13 10:46:52

Jean-Jacques Borie

Will be curious to know for HHVM?

2017-11-13 11:20:44

Seldaek

@Jean-Jacques Borie: HHVM is at 0.28% which is even lower than 6 months ago so I am not listing it.

2017-11-13 13:17:19

Howie

Isn't there a big selection bias here? The kind of folks still using PHP 5.3 are also quite likely not to be using composer, aren't they?

2017-11-13 13:32:51

brzuchal

@Howie the composer.json of Composer says it requires minimum PHP version 5.3.2, see https://github.com/composer/composer/blob/6be57475ac59fcf6001e0e9bbe7e18a66b94b8b1/composer.json#L25

2017-11-13 16:38:42

Caleb

TBH, I find it more bizarre that people would bother listing a minimum requirement of PHP >= 5.2.X for their packages with Packagist when Composer itself has a minimum requirement of PHP >= 5.3.2 (e.g., as nice as it may be for your packages to be backwards-compatible to PHP versions as early as 5.2.0, it's not like anyone installing them via Composer will actually need that).

2017-11-13 23:30:55

gggeek

@Caleb I can tell you of my own experience:

as maintainer of a php lib which has been bugfixes-only but still well maintained for the best part of the last 10 years, when I upgraded it to be installable via Composer (in 2014) I tagged it as requiring php 5.1, because that was the minimum requirement for running the lib itself.

Using composer was just one of the multiple installation options given to end users - and it made sense to keep the minimum-requirements info coherent across all media.

I even went as far as including in the lib itself a small autoloader for the users who would not be using composer and had codebases that predated php5 but would still like to upgrade.

Some of us do take backward compatibility seriously :-)

2017-11-14 09:22:51

Howie

@gggeek that was my point. I bet there are plenty of EL5 installations with PHP 5.2 still out there, running along with no Composer. I guess compared to the elephants in the room of drupal, wordpress etc, it might not make a *big* difference, but I think that 5.2 number is artificially low.

2017-11-16 01:10:55

Tomas Votruba

Thanks again for this summary!

This might help the PHP 7.1 to first place: https://gophp71.org/ />
And your posts as well, keep up great work