My view of PHP version adoption
Jordi Boggiano • November 14, 2014
news phpPHP 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.
November 2013
All versions | Grouped | |||||
Total | 4112760 | 100.00% | Total | 4112760 | 100.00% | |
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.4.4 | 274741 | 6.68% | ||||
PHP 5.4.9 | 198343 | 4.82% | ||||
PHP 5.4.16 | 180150 | 4.38% | ||||
PHP 5.4.19 | 167416 | 4.07% | ||||
PHP 5.5.3 | 166317 | 4.04% | ||||
PHP 5.4.17 | 160754 | 3.91% | ||||
PHP 5.4.21 | 144939 | 3.52% | ||||
PHP 5.3.26 | 131497 | 3.20% |
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% |
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
5.2 | 1204 | 4.23% |
5.3 | 20780 | 72.94% |
5.4 | 7953 | 27.92% |
5.5 | 641 | 2.25% |
5.6 | 44 | 0.15% |
PHP Requirements - Current Master - November 2014
5.2 | 1019 | 3.58% |
5.3 | 19334 | 67.86% |
5.4 | 7523 | 26.41% |
5.5 | 573 | 2.01% |
5.6 | 41 | 0.14% |
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.
Conclusions
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!