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. CI environments are excluded on a best-effort basis.
PHP usage statistics
November 2019 (+/- diff from May 2019)
|PHP 7.3.11||11.12%||PHP 7.3||35.24% (+19.89)|
|PHP 7.2.24||10.29%||PHP 7.2||31.66% (-7.32)|
|PHP 7.3.12||6.94%||PHP 7.1||15.27% (-10.32)|
|PHP 7.3.9||5.85%||PHP 5.6||6.91% (-0.77)|
|PHP 5.6.40||4.89%||PHP 7.0||6.04% (-3.39)|
|PHP 7.1.33||4.86%||PHP 7.4||2.92% (+2.92)|
A few observations: PHP 7.3 has grown very well and except for 7.4 (released Nov 28th) and 5.6 which is still holding on a bit more than it should, all versions are nicely ordered with the most recent being most used. With PHP 7.1 also reaching end of life a few days ago, the number of people using maintained PHP versions dropped to 70% (from 80%), a big drop but given the growth of 7.3 and 7.4 I think this should come back up very soon. PHP 5 usage across all versions is now around 9% (-1% from 6 months ago, we are definitely in long tail territory here).
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 - November 2019 (+/- diff from Recent Master May 2019)
Back in May PHP 7.2 and 7.1 were gaining mostly, now we see PHP 7.2 as the main winner and 7.3 starting to pick up pace. The most required PHP version is now 7.1 which is EOL so time to move on!