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 2018 (+/- diff from November 2017)
All versions Grouped PHP 7.2.4 7.54% PHP 7.1 35.02% (-1.61) PHP 7.1.16 7.41% PHP 7.0 23.02% (-7.74) PHP 7.0.28 5.54% PHP 7.2 20.18% (+20.18) PHP 7.1.15 4.11% PHP 5.6 16.48% (-6.8) PHP 7.2.3 3.85% PHP 5.5 3.50% (-2.61) PHP 7.1.14 3.79% PHP 5.4 1.04% (-0.47)
A few observations: PHP 7.1 is still on top but 7.2 is closing real quick with already 1/5th of users having upgraded. That's the biggest growth rate for a newly released version since I have started collecting those stats. Ubuntu 18.04 LTS ships with 7.2 so this number will likely grow even more in the coming months. 78% of people used PHP 7+ and almost 95% were using a PHP version that is still maintained, it sounds too good to be true. PHP 5.6 and 7.0 will reach end of life by late 2018 though so that's 40% of users who are in need of an upgrade if we want to keep these numbers up!
Here is the aggregate chart covering all my blog posts and the last five 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 - May 2018 (+/- diff from Recent Master November 2017)
5.21.16% (-0.12) 5.315.9% (-2.85) 5.416.59% (-3.7) 5.515.52% (-3.55) 5.619.57% (-0.83) 7.019.47% (4.62) 7.111.15% (5.83) 7.20.64% (0.61)
This is as usual lagging behind a little but PHP 7 is finally seeing some real adoption in the OSS world which is nice.Retweet