Jordi Boggiano

Jordi Boggiano Co-Founder of Private Packagist – Dev at TeamupComposer lead – Wandering Belgian – Speaker

Blog RSS Feed Twitter @seldaek

Categories

PHP Versions Stats - 2017.1 Edition

It's stats o'clock! See 2014, 2015, 2016.1 and 2016.2 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

May 2017 (+/- diff from November 2016)

All versions Grouped
PHP 5.6.30 14.73% PHP 7.0 36.12% (+1.11)
PHP 7.0.15 9.53% PHP 5.6 31.44% (-6.02)
PHP 5.5.9 6.12% PHP 7.1 17.64% (+16.28)
PHP 7.0.17 6.00% PHP 5.5 10.61% (-8.32)
PHP 7.1.3 5.88% PHP 5.4 3.11% (-2.29)
PHP 7.1.4 3.65% PHP 5.3 0.98% (-0.62)

A few observations: With a big boost of PHP 7.1 installs, PHP 7 overall now represents over 50%. 5.3/5.4 are really tiny and even 5.5 is dropping significantly which is good as it is not maintained anymore since last summer. That's a total of 85% of installs done on supported versions, which is pretty good.

And because a few people have asked me this recently, while HHVM usage is not included above in the graph it is at 0.36% which is a third of PHP 5.3 usage and really hardly significant. I personally think it's fine to support it still in libraries if it just works, or if the fixes involved are minor. If not then it's probably not worth the time investment.

Also.. since I now have quite a bit of data accumulated and the pie chart format is kind of crappy to see the evolution, here is a new chart which shows the full historical dataset!

It is pretty interesting I think as it shows that 5.3/5.4/5.5 had people slowly migrating in bunches and the versions peaked at ~50% of the user base. On the other hand 5.6/7.0/7.1 peak around 35% which seems to indicate people are moving on faster to new versions. This is quite encouraging!

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 2017 (+/- diff from November 2016)

5.2 2.13% (-0.22)
5.3 37.6% (-3.65)
5.4 28.38% (-1.74)
5.5 17.11% (+0.13)
5.6 9.37% (+3.15)
7.0 4.61% (+1.53)
7.1 0.81% (+0.81)

A few observations: This is as usual moving pretty slowly. I think I can give up trying to advise for change, it doesn't seem to be working.. On the other hand it looks like Symfony is going to use 7.0 or 7.1 for it's v4 to come out later this year, so hopefully that will shake things up a bit and make more libraries also realize they can bump to PHP 7.

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

In response to Nikita's comment below I ran the requirements numbers for packages that had some sort of commit activity over the last year. This excludes all stale/done packages and looks much more encouraging, but the difference points are probably overly large because they compare to the old numbers which included everything, therefore take those with a pinch of salt, and in the next six months update I'll have more trusty numbers.

5.2 1.52% (-0.83)
5.3 23.15% (-18.1)
5.4 24.41% (-5.71)
5.5 23.7% (+6.72)
5.6 16.81% (+10.59)
7.0 8.73% (+5.65)
7.1 1.67% (+1.67)

May 06, 2017 // News, PHP

Post a comment

Subscribe to this RSS Feed Comments

2017-05-07 16:04:53

nikic

For the PHP version requirements it might be interesting to only consider packages that have made a release in the last X months (say, one year). Abandoned packages that have not seen any recent activity are unlikely to bump version requirements, after all.

2017-05-07 20:27:03

Derick

It really ticks me off you didn't keep the same colours for versions in the two pie charts. Really tricky to compare now. Order of versions in their legend is weird too.

2017-05-08 06:29:40

Seldaek

@Derick: Ouch, that was accidental. I actually did try to keep the same colors, which is what leads to the crappy ordering because the colors are assigned by order. Anyway I fixed this by assigning colors explicitly and now the line graph even matches. @nikic: Very good point. Added those numbers too now, looks better :)

2017-05-08 09:17:52

ocramius

HHVM being at 0.36% probably means that only Travis-CI is running it.

Too bad: I had high hopes for it, but the compatibility issues list is getting a bit out of control, while PHP 7 is pretty much stable.

2017-05-08 09:33:49

Seldaek

@ocramius: These numbers ignore Travis CI and other CI systems that set the "CI" env var in their workers. Without excluding those HHVM is around 0.95% so it's still low but those .36% is probably actual usage.