WordPress & PHP 7: Yay or Nay?

How many of you themeforest (and codecanyon) authors are using or planing to use PHP 7 as a minimum PHP version on your WordPress themes/plugins?

Most themes nowadays seem to support 5.6 as the minimum PHP version, but seeing that 5.6 usage has fallen bellow 15% (10.5% to be exact), wouldn’t it make sense to start using PHP 7 for new themes? All client sites I’ve been given access (to help fix issues with my plugins) were using PHP 7 to 7.4

I’m thinking of developing my new theme in PHP 7. Would it be too risky? This is the market share as of today (keep in mind this is for all Wordpress sites (including people who’ve never purchased a theme or plugin)):

And this is what it looked like in early 2019:

Screen Shot 2021-03-12 at 3.26.55 PM

5.6 usage decreased in half in just two years. This trend is going to continue for the next few years.

Right now I can think of two very popular plugins that require PHP 7:

-Woocommerce: 5 million installs

  • Rank Math SEO: 700,000 installs

With all of this in mind, do you think is unwise to code my next theme with PHP 7? I really want to take advantage of the new language features.

What do you guys think?

I have customers which are already using PHP 8 (ok, it is just 1 for which I know for sure). I am testing/running my themes only on PHP 7 but also have start to do some tests on PHP 8.

Php 5.X is out of date.

https://www.php.net/supported-versions.php

2 Likes

I think it’s ok to develop with PHP 7, but in case if you have complaining customers who still using 5.6 you can try to encourage them to switch to version 7 or provide a patch.

2 Likes

I use PHP 7.x about one year. I think to increase it to PHP 8.x in a few months.

3 Likes

That’s great to hear, have you found issues with customers not being able to install them because of using PHP 5?

I’m hoping the market share for PHP 5 keeps decreasing since providing patches for lower versions of PHP isn’t really feasible.

Great to hear more authors using PHP 7. PHP 8 as a minimum version is absolutely crazy. It’s a version that doesn’t play well when it comes to backwards compatibility (see The WordPress and PHP 8 compatibility report • Yoast Developer Blog).

It’s a great version but it breaks a lot of stuff. I suppose a lot of people will be stuck with PHP 7 for a while. It’s very likely PHP 7 will become the new PHP 5 in 5-10 years.

Thankfully there’s a tool called Rector (see GitHub - rectorphp/rector: Instant Upgrades and Instant Refactoring of any PHP 5.3+ code) that lets you compile (or transpile) most features from 7.4-8.0 to 7.0 (Kind of like webpack/babel for JavaScript). I’ll probably give that tool a try sometime this year.

1 Like

I’m using PHP 7 for some time now…

1 Like

That’s great to hear. Did you use it in your last theme, If I may ask?

Yes I did.

Still it’s good to develop in PHP 7