From ae03165ac446f0453fbe311c428b3739ada845cc Mon Sep 17 00:00:00 2001 From: Ben Word Date: Sat, 21 Mar 2026 21:16:37 -0500 Subject: [PATCH 1/3] Drop Composer v1 support --- .github/workflows/tests.yml | 1 + README.md | 11 +++++++ composer.json | 4 +-- tests/phpunit/WordPressCoreInstallerTest.php | 6 +--- tests/phpunit/WordPressCorePluginTest.php | 31 ++------------------ 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index decb5cb..6ab7bd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,6 +29,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} + tools: composer:v2 coverage: xdebug - name: Install dependencies diff --git a/README.md b/README.md index e4c5920..4764826 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,17 @@ This installer is meant to support a rather specific WordPress installation setu For more information on this site setup and using Composer to manage a whole WordPress site, [check out @Rarst's informational website](https://composer.rarst.net/) which also includes [a site stack example using this package](https://composer.rarst.net/recipe/site-stack/). +## Requirements + +- Composer 2+ +- PHP 7.2.24+ + +Composer 2 requires explicitly allowing plugins. If needed, run: + +```bash +composer config --no-plugins allow-plugins.roots/wordpress-core-installer true +``` + ## Support us Roots is an independent open source org, supported only by developers like you. Your sponsorship funds [WP Packages](https://wp-packages.org/) and the entire Roots ecosystem, and keeps them independent. Support us by purchasing [Radicle](https://roots.io/radicle/) or [sponsoring us on GitHub](https://github.com/sponsors/roots) — sponsors get access to our private Discord. diff --git a/composer.json b/composer.json index 538e812..30bcdd3 100644 --- a/composer.json +++ b/composer.json @@ -32,11 +32,11 @@ "class": "Roots\\Composer\\WordPressCorePlugin" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", + "composer-plugin-api": "^2.0", "php": ">=7.2.24" }, "require-dev": { - "composer/composer": "^1.0 || ^2.0", + "composer/composer": "^2.0", "phpunit/phpunit": "^8.5" }, "conflict": { diff --git a/tests/phpunit/WordPressCoreInstallerTest.php b/tests/phpunit/WordPressCoreInstallerTest.php index 12a592c..2bf938a 100644 --- a/tests/phpunit/WordPressCoreInstallerTest.php +++ b/tests/phpunit/WordPressCoreInstallerTest.php @@ -221,11 +221,7 @@ private function jpbExpectException($class, $message = '', $isRegExp = false) $this->expectException($class); if ($message) { if ($isRegExp) { - if (method_exists($this, 'expectExceptionMessageRegExp')) { - $this->expectExceptionMessageRegExp($message); - } else { - $this->expectExceptionMessageMatches($message); - } + $this->expectExceptionMessageMatches($message); } else { $this->expectExceptionMessage($message); } diff --git a/tests/phpunit/WordPressCorePluginTest.php b/tests/phpunit/WordPressCorePluginTest.php index 9a753da..142d8ca 100644 --- a/tests/phpunit/WordPressCorePluginTest.php +++ b/tests/phpunit/WordPressCorePluginTest.php @@ -24,11 +24,8 @@ use Composer\Composer; use Composer\Config; use Composer\Installer\InstallationManager; -use Composer\IO\IOInterface; use Composer\IO\NullIO; use Composer\Package\RootPackage; -use Composer\Plugin\PluginInterface; -use Composer\Test\Mock\HttpDownloaderMock; use Composer\Util\HttpDownloader; use Composer\Util\Loop; use Roots\Composer\WordPressCorePlugin; @@ -55,7 +52,9 @@ public function testActivate() $composer->setDownloadManager($downloadManager); $nullIO = new NullIO(); - $installationManager = $this->getInstallationManager($composer, $nullIO); + $http = new HttpDownloader($nullIO, $composer->getConfig()); + $loop = new Loop($http); + $installationManager = new InstallationManager($loop, $nullIO); $composer->setInstallationManager($installationManager); $plugin = new WordPressCorePlugin(); @@ -65,28 +64,4 @@ public function testActivate() $this->assertInstanceOf('\Roots\Composer\WordPressCoreInstaller', $installer); } - - /** - * @param Composer $composer - * @param IOInterface $io - * - * @return InstallationManager - */ - private function getInstallationManager($composer, $io) - { - $installationManager = null; - switch (explode('.', PluginInterface::PLUGIN_API_VERSION)[0]) { - case '1': - $installationManager = new InstallationManager(); - break; - case '2': - default: - $http = new HttpDownloader($io, $composer->getConfig()); - $loop = new Loop($http); - $installationManager = new InstallationManager($loop, $io); - break; - } - - return $installationManager; - } } From bf65d5f0393b4ced3214e106c3acf4d2bd7c1535 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Sat, 21 Mar 2026 21:34:48 -0500 Subject: [PATCH 2/3] Revise README --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4764826..794d45d 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,18 @@ [![Follow Roots](https://img.shields.io/badge/follow%20@rootswp-1da1f2?logo=twitter&logoColor=ffffff&message=&style=flat-square)](https://twitter.com/rootswp) [![Sponsor Roots](https://img.shields.io/badge/sponsor%20roots-525ddc?logo=github&style=flat-square&logoColor=ffffff&message=)](https://github.com/sponsors/roots) -*This is a fork of [johnpbloch/wordpress-core-installer](https://github.com/johnpbloch/wordpress-core-installer) with some fixes to enhance compatibility with [roots/wordpress](https://packagist.org/packages/roots/wordpress)* +> [!NOTE] +> This is a fork of [johnpbloch/wordpress-core-installer](https://github.com/johnpbloch/wordpress-core-installer) with fixes to enhance compatibility with [roots/wordpress](https://packagist.org/packages/roots/wordpress). A custom Composer plugin to install WordPress core outside of `vendor`. This installer is meant to support a rather specific WordPress installation setup in which WordPress is installed in a subdirectory ([see the WordPress codex on that subject](https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)) and in which the location of `WP_CONTENT_DIR` and `WP_CONTENT_URL` have been customized to be outside of WordPress core ([see the WordPress codex on that subject](https://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder)). This is because composer will delete your whole wp-content directory every time it updates core if you don't separate the two. If that installation setup isn't what you are looking for, then this installer is probably not something you will want to use. -For more information on this site setup and using Composer to manage a whole WordPress site, [check out @Rarst's informational website](https://composer.rarst.net/) which also includes [a site stack example using this package](https://composer.rarst.net/recipe/site-stack/). +For more information on using Composer with WordPress, check out our [Composer WordPress resources](https://roots.io/composer-wordpress-resources/). Use [WP Packages](https://wp-packages.org/) to install WordPress plugins and themes via Composer, and see the [`roots/wordpress` documentation](https://wp-packages.org/roots-wordpress) for WordPress core installation options. + +## Support us + +Roots is an independent open source org, supported only by developers like you. Your sponsorship funds [WP Packages](https://wp-packages.org/) and the entire Roots ecosystem, and keeps them independent. Support us by purchasing [Radicle](https://roots.io/radicle/) or [sponsoring us on GitHub](https://github.com/sponsors/roots) — sponsors get access to our private Discord. ## Requirements @@ -25,10 +30,6 @@ Composer 2 requires explicitly allowing plugins. If needed, run: composer config --no-plugins allow-plugins.roots/wordpress-core-installer true ``` -## Support us - -Roots is an independent open source org, supported only by developers like you. Your sponsorship funds [WP Packages](https://wp-packages.org/) and the entire Roots ecosystem, and keeps them independent. Support us by purchasing [Radicle](https://roots.io/radicle/) or [sponsoring us on GitHub](https://github.com/sponsors/roots) — sponsors get access to our private Discord. - ## Community Keep track of development and community news. From 7aa68eebe1bca11674d4537936ef5a703526baa2 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Sat, 21 Mar 2026 21:37:50 -0500 Subject: [PATCH 3/3] update php versions used in tests --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ab7bd4..5a9438e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,6 +21,8 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' + - '8.5' steps: - uses: actions/checkout@v4