WordPress runs on PHP, and so does every plugin. The question is not whether to know PHP but which PHP: the version you write for decides which language features you can use.

Two PHP worlds in one project

WherePHP
Our site8.3 or newer
Public pluginsMostly 7.4 and up, for WordPress.org users on older hosting
Newer plugins8.0 and up, for example SEO Helper and LMS4WP

A plugin written for the widest audience cannot use newer language features, even if your own server runs the latest PHP. Decide the minimum version first, and declare it in both the plugin header (Requires PHP) and composer.json.

How we organize PHP code

  • Namespaces: our plugins use ForWP\…, so class names never collide with other plugins.
  • Autoloading: some plugins, such as Drive and LMS4WP, load classes through Composer PSR-4 autoload instead of manual require calls.
  • Strict types: used in MCP Connector, where data passes between agents and the site.

Tooling

ToolWhat it doesWhere we use it
PHPCS with WPCSWordPress Coding StandardsPlugins
PHPCompatibilityChecks code against the declared PHP versionsPlugins
PHPUnitUnit testsPlugins
PintCode styleSite
php -lSyntax check before every commit and deploySite

Related