wpengine / wpengine/wpackagist

Require `wordpress/core-implementation` and `php` as defined by the plugin

Open
#516 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
768
Forks
69
Avg merge
3h 52m
Merged PRs (30d)
1

Description

Hello,
I've long noticed a potential area for improvement concerning compatibility checks with PHP versions and specific WordPress core versions. Currently, developers need to manually ensure that their WordPress environment matches the requirements of the plugins and themes they incorporate.

Example

Let's assume my project has this composer.json:

{
  "name": "alpipego/test",
  "description": "Testing core and PHP requirements",
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org",
      "canonical": true,
      "only": [
        "wpackagist-plugin/*",
        "wpackagist-theme/*"
      ]
    }
  ],
  "require": {
    "johnpbloch/wordpress-core": "5.4.*",
    "johnpbloch/wordpress-core-installer": "^2.0",
    "wpackagist-plugin/query-monitor": "^3.2.2"
  },
  "config": {
    "platform": {
      "php": "7.0"
    },
    "allow-plugins": {
      "composer/installers": true,
      "johnpbloch/wordpress-core-installer": true
    }
  },
  "extra": {
    "wordpress-install-dir": "public/wp",
    "installer-paths": {
      "public/wp-content/mu-plugins/{$name}/": [
        "type:wordpress-muplugin"
      ],
      "public/wp-content/plugins/{$name}/": [
        "type:wordpress-plugin"
      ],
      "public/wp-content/themes/{$name}/": [
        "type:wordpress-theme"
      ]
    }
  }
}

As of writing, this will install WordPress core in version 5.4.15 and Query Monitor in version 3.15.0. However, the installed Query Monitor version requires at least WordPress 5.6 and PHP 7.4, neither of which are satisfied in the current project configuration.

This is the header for the installed QM version:

# Query Monitor
Contributors: johnbillion
Tags: debug, debug-bar, development, performance, query monitor, rest-api
Requires at least: 5.6
Tested up to: 6.4
Stable tag: 3.15.0
License: GPLv2 or later
Requires PHP: 7.4
Donate link: https://github.com/sponsors/johnbillion

Suggestion

  • Implement a feature within WPackagist that automatically checks and enforces compatibility based on the Requires at least field provided by the WordPress.org Plugin/Theme API for the WordPress version and Requires PHP for the PHP version.
  • Require wordpress/core-implementation for WordPress core (https://packagist.org/providers/wordpress/core-implementation)

Potential Breaking Change

While this proposal aims to improve compatibility checks, it's crucial to consider the potential for breaking changes in websites that currently do not install a WordPress core package that provides wordpress/core-implementation.


I haven't looked into https://github.com/WordPress/wp-plugin-dependencies deeply, but I assume it's something that could/should be considered down the line.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the WPackagist issue requirements and the Composer example, then trace how WordPress plugin and theme metadata is obtained from the WordPress.org API. Done means incompatible PHP and WordPress core requirements are enforced, including the proposed wordpress/core-implementation provider behavior, with the potential breaking change addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.