My view of PHP version adoption
Jordi Boggiano • November 14, 2014news php
PHP 5.3 has been out of maintenance for about three months now and it seems like it's time for the community to move on at last. Drupal8 will target 5.4. Symfony announced the results of a poll about which PHP version Symfony3 should target (TL;DR: 5.5 and 5.6 are preferred). And Pascal Martin released yesterday an update on his PHP usage stats based on scanning server headers.
Pascal's number are interesting but I believe they have a bias towards older PHP versions. I would argue that people configuring their servers properly are also those that tend to keep up to date with newer versions, and part of the best practices is to avoid publishing the software versions you are using (i.e. disable expose_php in php.ini). If I am correct here that means early adopters are mis-represented in those numbers.
In any case, I do have another biased dataset to present so here it comes! I looked in the packagist.org logs of the last fifty days for
GET /packages.json which represents a composer update done by someone. Since Composer sends the PHP version it is running with in its
User-Agent header, I can use that to see which PHP versions people are using Composer with. Of course this data set is probably biased towards development machine 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 2013 and today, which shows the progression of various versions. Any version below 3% usage has been removed to keep things readable.
|PHP 5.3.10||490350||11.92%||PHP 5.4||2069021||50.31%|
|PHP 5.3.3||419871||10.21%||PHP 5.3||1533073||37.28%|
|PHP 5.4.20||387450||9.42%||PHP 5.5||510596||12.41%|
|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%|
A few observations: 5.3 really is on the way out, 5.5 is now the major platform, 5.6 adoption is lagging behind last year's 5.5 adoption a little bit which is unfortunate but can perhaps be explained by the fact Ubuntu 14.04 ships with 5.5.9
PHP requirements in Packages
A second dataset I looked at is which versions are required by all the PHP packages present on packagist. I split it in two groups: those that required a given version at any point and those that require it in their current master version.
PHP Requirements - Anytime - November 2014
PHP Requirements - Current Master - November 2014
A few observations: almost 7% of packages that required 5.3 and 15% of those requiring 5.2 gave these up for higher requirements, that's pretty low but it's a start. 5.4 is getting a good foothold but 5.5/5.6 features are hardly used by OSS packages.
Again these numbers need to be taken with a grain of salt, but looking at the ecosystem from this perspective I would say PHP 5.3 can be safely dropped by most libraries and 5.5 sounds like a promising target!