Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
# Keep in sync with the tests below and "Requires PHP" (7.4)
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
Expand All @@ -39,11 +40,13 @@ jobs:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
coverage: none
tools: composer
- name: Install dependencies
run: composer install --no-interaction --no-progress
# PHPCompatibility 10 knows the changes up to PHP 8.5; testVersion
# "7.4-" in phpcs.xml.dist checks all of them
- name: Run PHPCS (PHPCompatibilityWP)
run: composer phpcs

Expand All @@ -53,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.3']
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
services:
mariadb:
image: mariadb:10.11
Expand Down
Binary file modified .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WordPress plugin, published on wordpress.org (slug `wirecore-rest-control`) and
- Prefix everything global: functions/options/hooks/nonces `wirecore_rc_`, constants `WIRECORE_RC_`, CSS classes/IDs `wirecore-rc-`, text domain `wirecore-rest-control`, WP-CLI command `wp wirecore-rest`.
- Admin pages in plain PHP with `admin-post.php` forms, nonces, `wp_safe_redirect()` plus a notice query arg. No build step for JS; the only CSS build is `npm run build:css` (below).
- UI in the WireLayer corporate design: the markup uses the `.wc-*` classes of `@wirecore/wirelayer-css` (class reference: `node_modules/@wirecore/wirelayer-css/llms-full.txt`). `npm run build:css` writes the used components, scoped to `#wirecore-rc`, to `assets/wirelayer/` – committed, CI checks it is up to date. Add a component to the list in `package.json` before using its classes, and run the command again after updating the package. `wirecore-rc-*` classes are hooks for `admin.js` and page layout in `assets/admin.css` (scoped to `#wirecore-rc`, colors and spacing from WireLayer variables). Icons are inline Lucide SVGs (`WireCore_RC_Admin::icon()`).
- Minimum versions: WordPress 5.8, PHP 7.4 (verified with PHPCompatibility and a WP 5.8/PHP 7.4 instance) – do not use newer functions without raising them.
- Supported versions: WordPress 5.8+, PHP 7.4 – 8.5 (verified with PHPCompatibility 10, a WP 5.8/PHP 7.4 instance and the tests on every PHP version) – do not use newer functions without raising the minimum, and avoid anything deprecated up to PHP 8.5 (e.g. `ReflectionProperty::setAccessible()` only below PHP 8.1). The Docker environment runs PHP 8.5.
- Formatting with Prettier (tabs, single quotes). Plugin Check must stay free of errors and warnings; justified exceptions are marked with `phpcs:ignore`/`phpcs:disable` plus a comment explaining why.

## Architecture
Expand Down Expand Up @@ -43,7 +43,7 @@ Only `wirecore-rest-control.php`, `uninstall.php`, `index.php`, `readme.txt`, `L

## Checks

CI (`.github/workflows/ci.yml`) must stay green: PHP lint 7.4–8.4, `composer phpcs` (PHPCompatibilityWP, `phpcs.xml.dist`), PHPUnit on PHP 7.4 and 8.3, `npm run format:check`, `assets/wirelayer/` up to date with `npm run build:css`, Plugin Check in strict mode on the package built from `.distignore`.
CI (`.github/workflows/ci.yml`) must stay green: PHP lint 7.4–8.5, `composer phpcs` (PHPCompatibilityWP, `phpcs.xml.dist`), PHPUnit on PHP 7.4–8.5 (see README for the loop over all versions in Docker), `npm run format:check`, `assets/wirelayer/` up to date with `npm run build:css`, Plugin Check in strict mode on the package built from `.distignore`.

Tests live in `tests/` (`test-*.php`, base class `WireCore_RC_TestCase`). They are integration tests against the WordPress test suite: dispatch requests through `rest_get_server()->dispatch()` (the bootstrap defines `REST_REQUEST`), and register fixture routes in `tests/bootstrap.php` – the route list is cached, so routes must exist before the first REST server is created. Run them inside the Docker container (see README) against the separate database `wordpress_test`.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM wordpress:php8.2-apache
FROM wordpress:php8.5-apache

# install some needed packages
RUN apt update && apt install mariadb-client -y
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ docker compose up -d # WordPress on http://localhost:8092, phpMyAdmin on :8093
npm install # Prettier with the PHP plugin, @wirecore/wirelayer-css
```

The container runs the newest supported PHP version (8.5, see `Dockerfile`), so deprecations show up during development.

The settings page uses the [WireLayer](https://github.com/WireCore/WireLayer) components (`.wc-*` classes). `npm run build:css` writes the components listed in `package.json`, scoped to `#wirecore-rc`, with their fonts to `assets/wirelayer/`. The output is committed, so the plugin needs no build step; run the command again after adding a component or updating `@wirecore/wirelayer-css`.

WP-CLI is available in the container:
Expand Down Expand Up @@ -105,6 +107,17 @@ docker compose exec -w /var/www/html/wp-content/plugins/wirecore-rest-control wo

The database settings in [`tests/wp-tests-config.php`](tests/wp-tests-config.php) default to the Docker environment and can be overridden with `WP_TESTS_DB_HOST`, `WP_TESTS_DB_USER`, `WP_TESTS_DB_PASSWORD` and `WP_TESTS_DB_NAME`.

The plugin supports PHP 7.4 – 8.5. To run the syntax check and the tests on every version like the CI does, use the official PHP images in the network of the Docker environment:

```bash
for v in 7.4 8.0 8.1 8.2 8.3 8.4 8.5; do
docker run --rm --network "$(basename "$PWD" | tr '[:upper:]' '[:lower:]')_default" -v "$PWD":/app -w /app -e WP_TESTS_DB_PASSWORD=password php:$v-cli \
sh -c "docker-php-ext-install mysqli >/dev/null && find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -exec php -l {} \; | grep -v 'No syntax errors'; vendor/bin/phpunit"
done
```

Composer installs the dependencies for PHP 7.4 (`config.platform` in `composer.json`), so the same `vendor/` works on every version.

### Translations

All UI strings are English in the code (text domain `wirecore-rest-control`) and translated in `languages/`. After changing strings (`P=wp-content/plugins/wirecore-rest-control`):
Expand All @@ -125,9 +138,9 @@ Only the files needed by the plugin are shipped. Development files are excluded

[`.github/workflows/ci.yml`](.github/workflows/ci.yml) runs on every push to `main` and on pull requests:

- PHP syntax check on PHP 7.4 – 8.4
- PHP compatibility for the minimum PHP version (`composer phpcs`, see [`phpcs.xml.dist`](phpcs.xml.dist))
- PHPUnit on PHP 7.4 and 8.3 (`composer test`)
- PHP syntax check on PHP 7.4 – 8.5
- PHP compatibility from PHP 7.4 up to 8.5 with PHPCompatibility 10 (`composer phpcs`, see [`phpcs.xml.dist`](phpcs.xml.dist))
- PHPUnit on PHP 7.4 – 8.5 (`composer test`); deprecations fail the tests
- Prettier (`npm run format:check`)
- Plugin Check on the built package, warnings included

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.10",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpcompatibility/phpcompatibility-wp": "^3.0@alpha",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpunit/phpunit": "^9.6",
"yoast/phpunit-polyfills": "*",
"wp-phpunit/wp-phpunit": "*",
"roots/wordpress-no-content": "*"
"roots/wordpress-no-content": "*",
"phpcompatibility/php-compatibility": "^10.0@alpha",
"phpcompatibility/phpcompatibility-paragonie": "^2.0@alpha"
},
"config": {
"allow-plugins": {
Expand Down
Loading
Loading