It's stats o'clock! See 2014, 2015, 2016.1, 2016.2, 2017.1, 2017.2, 2018.1 and 2018.2 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.

PHP usage statistics

May 2019 (+/- diff from November 2018)

All versions Grouped PHP 7.2.17 8.80% PHP 7.2 38.98% (+6.35) PHP 7.2.18 8.13% PHP 7.1 25.59% (-6.11) PHP 7.3.5 7.95% PHP 7.3 15.35% (+15.35) PHP 7.1.29 5.19% PHP 7.0 9.43% (-9.97) PHP 7.0.33 4.90% PHP 5.6 7.68% (-3.96) PHP 5.6.40 4.08% PHP 5.5 1.52% (-0.86)

A few observations: PHP 7.3 is growing almost as well as 7.2 last year. With PHP 5.6 and 7.0 reaching end of life at the end of 2018, the number of people using maintained PHP versions dropped to 80% (from 84%), which is really not as bad as I expected as 31% of people had to upgrade. PHP 5 usage across all versions is now around 10%.

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 2019 (+/- diff from Recent Master November 2018)

5.2 0.91% (-0.2) 5.3 11.16% (-2.61) 5.4 12.13% (-2.27) 5.5 10.98% (-2.44) 5.6 16.04% (-1.62) 7.0 19.18% (-1.09) 7.1 23.8% (6.63) 7.2 5.41% (3.22) 7.3 0.38% (0.37) 7.4 0.01% (0.01)

The push towards PHP 7.1 and 7.2 happened even faster than in the previous six months. The most required PHP version is still one that is still maintained which is also pretty good news!