PHP Versions Stats - 2020.2 Edition
See 2014, 2015, 2016.1, 2016.2, 2017.1, 2017.2, 2018.1, 2018.2, 2019.1, 2019.2 and 2020.1 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. CI environments are excluded on a best-effort basis.
PHP usage statistics
November 2020 (+/- diff from May 2020)
|PHP 7.4.12||13.10%||PHP 7.4||42.61% (+22.55)|
|PHP 7.4.9||7.88%||PHP 7.3||27.05% (-3.00)|
|PHP 7.4.10||5.55%||PHP 7.2||15.28% (-12.21)|
|PHP 7.3.24||5.34%||PHP 7.1||7.45% (-4.1)|
|PHP 7.3.21||5.06%||PHP 5.6||2.71% (-2.28)|
|PHP 7.2.34||3.92%||PHP 7.0||2.70% (-1.30)|
A few observations: 7.4 caught up amazingly, reaching the highest peak percentage since PHP 5.5 in 2015, which really was another era of people not upgrading anything. As usual in November with the new PHP release (8.0 came out last week!) and the older release (7.2) becoming EOL, the percentage of people using maintained PHP versions drops a bit suddenly. We are still at 69.7% of people using maintained PHP versions though which is not bad.
Here is the aggregate chart covering all my blog posts and the last six years.
PHP requirements in Packages
The second dataset is which versions are required by the PHP packages present on Packagist.org. I only check the require statement in their current default branch 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 Default Branches - November 2020 (+/- diff from May 2020)
In the last two blog posts I wrote, PHP 7.2 was the big winner and it has now shifted to 7.3 and 7.4 both gaining a lot. The most required PHP version is however still 7.1. According to the charts above I would say 7.3 is still a good target for any library looking to support most users, but 7.4 brings you nice features and is almost at 50% adoption already. PHP 8 is still a bit new but we'll see how that goes in the next half year!