From e2042d16077de3af6b238c1e01295278ac13a646 Mon Sep 17 00:00:00 2001 From: makriman <9696567+makriman@users.noreply.github.com> Date: Fri, 4 Dec 2026 06:48:41 +0000 Subject: [PATCH 1/2] README: Composer install through a vcs repository until the Packagist listing The package is not on Packagist yet, so the bare composer require in the README failed. Document the vcs repository entry with no-api set, which installs without a GitHub token, and say the listing is pending. Fixes #5 --- CHANGELOG.md | 6 ++++++ README.md | 27 ++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d00a30..10cafaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- README: the Composer install now works while the Packagist listing is + pending. It adds the GitHub repository as a `vcs` source with + `"no-api": true`, so no GitHub token is needed (#5). + Ideas under consideration, not promises: - A read-only REST endpoint for monitoring. diff --git a/README.md b/README.md index 3e646b8..8ed546f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,32 @@ Requirements: PHP 8.1 or later, WordPress 6.4 or later, MySQL 5.7+ or MariaDB 10 **Without Composer.** Nothing to do: the plugin loads its own classes through `autoload.php`. To use the classes outside the plugin, `require 'path/to/gen-queue/autoload.php';`. -**With Composer.** `composer require indianopinion/gen-queue` (type `wordpress-plugin`, so installers place it in your plugins folder). It has no runtime dependencies. +**With Composer.** The package is not on Packagist yet (the listing is pending), so tell Composer where it lives first, then require it (type `wordpress-plugin`, so installers place it in your plugins folder): + +```sh +composer config repositories.gen-queue '{"type": "vcs", "url": "https://github.com/IndianOpinion/gen-queue", "no-api": true}' +composer require indianopinion/gen-queue +``` + +That leaves this in your `composer.json`: + +```json +{ + "repositories": [ + { + "name": "gen-queue", + "type": "vcs", + "url": "https://github.com/IndianOpinion/gen-queue", + "no-api": true + } + ], + "require": { + "indianopinion/gen-queue": "^0.1.0" + } +} +``` + +`"no-api": true` makes Composer read the repository with git instead of the GitHub API. Without it, an anonymous install fails once the API's limit of 60 requests an hour is used up, which happens quickly on shared machines and CI runners. With it, no GitHub token is needed. It has no runtime dependencies, so no other entry is needed. When the Packagist listing is live, the plain `composer require indianopinion/gen-queue` will work and the `repositories` entry can go. ## Quick start From fabb12e5eacfe986f18ddfc87ebb24f94983299a Mon Sep 17 00:00:00 2001 From: makriman <9696567+makriman@users.noreply.github.com> Date: Sat, 5 Dec 2026 03:41:02 +0000 Subject: [PATCH 2/2] README: Composer install puts the plugin in the plugins folder A plain composer require left the plugin in vendor/, where WordPress never loads it, because the package does not require composer/installers. The README now allows and requires composer/installers, sets installer-paths when composer.json is not in the WordPress root, shows the resulting composer.json, and says git is needed for the no-api repository entry. CHANGELOG: the new Fixed heading had been inserted above the "Ideas under consideration" list, so the roadmap read as part of Fixed. The list is back directly under Unreleased, with Fixed after it. Refs #5 --- CHANGELOG.md | 15 +++++++++------ README.md | 38 +++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10cafaa..e3045e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,17 +6,20 @@ uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -### Fixed - -- README: the Composer install now works while the Packagist listing is - pending. It adds the GitHub repository as a `vcs` source with - `"no-api": true`, so no GitHub token is needed (#5). - Ideas under consideration, not promises: - A read-only REST endpoint for monitoring. - A network-wide cap on multisite. +### Fixed + +- README: the Composer install now works while the Packagist listing is + pending. It adds the GitHub repository as a `vcs` source with + `"no-api": true`, so no GitHub token is needed, and gives the steps that + put the plugin in the site's plugins folder rather than `vendor/`: + allowing and requiring `composer/installers`, and `installer-paths` when + `composer.json` is not in the WordPress root (#5). + ## [0.1.0] - 2026-11-14 ### Added diff --git a/README.md b/README.md index 8ed546f..e20cc7b 100644 --- a/README.md +++ b/README.md @@ -24,32 +24,48 @@ Requirements: PHP 8.1 or later, WordPress 6.4 or later, MySQL 5.7+ or MariaDB 10 **Without Composer.** Nothing to do: the plugin loads its own classes through `autoload.php`. To use the classes outside the plugin, `require 'path/to/gen-queue/autoload.php';`. -**With Composer.** The package is not on Packagist yet (the listing is pending), so tell Composer where it lives first, then require it (type `wordpress-plugin`, so installers place it in your plugins folder): +**With Composer.** The package is not on Packagist yet (the listing is pending), so tell Composer where it lives first. The package type is `wordpress-plugin`, and Composer puts such a package in `vendor/`, where WordPress never loads it, unless the project uses [`composer/installers`](https://github.com/composer/installers). This package does not pull that in, so the project has to. Run these where your `composer.json` is (run `composer init` first if there is none): ```sh composer config repositories.gen-queue '{"type": "vcs", "url": "https://github.com/IndianOpinion/gen-queue", "no-api": true}' +composer config allow-plugins.composer/installers true +composer require composer/installers composer require indianopinion/gen-queue ``` -That leaves this in your `composer.json`: +- `allow-plugins`: `composer/installers` is a Composer plugin, and Composer 2.2 and later refuse to run a plugin that `allow-plugins` does not list. Without that line, `composer require composer/installers` stops with "blocked by your allow-plugins config" when it cannot ask (CI, scripts, `--no-interaction`). +- Where the plugin lands: `composer/installers` puts it in `wp-content/plugins/gen-queue/` relative to `composer.json`. That is your site's plugins folder only when `composer.json` sits in the WordPress root (next to `wp-config.php`). If it sits elsewhere, say where the plugins folder is **before** requiring the plugin, with the path relative to `composer.json`, for example for WordPress in `web/`: + + ```sh + composer config --json extra.installer-paths '{"web/wp-content/plugins/{$name}/": ["type:wordpress-plugin"]}' + ``` + + Bedrock and similar projects already set `installer-paths` and allow the plugin, so there only the first and last commands are needed. +- `"no-api": true` makes Composer read the repository with git over HTTPS instead of the GitHub API. A plain `vcs` entry reads every branch and tag through the API, which allows anonymous callers 60 requests an hour, so it often fails without a GitHub token on shared machines and CI runners. With `no-api`, no token is needed, but the machine running Composer needs `git`. + +With `composer.json` in the WordPress root, that adds these entries to it: ```json { - "repositories": [ - { - "name": "gen-queue", - "type": "vcs", - "url": "https://github.com/IndianOpinion/gen-queue", - "no-api": true - } - ], "require": { + "composer/installers": "^2.3", "indianopinion/gen-queue": "^0.1.0" + }, + "repositories": [{ + "name": "gen-queue", + "type": "vcs", + "url": "https://github.com/IndianOpinion/gen-queue", + "no-api": true + }], + "config": { + "allow-plugins": { + "composer/installers": true + } } } ``` -`"no-api": true` makes Composer read the repository with git instead of the GitHub API. Without it, an anonymous install fails once the API's limit of 60 requests an hour is used up, which happens quickly on shared machines and CI runners. With it, no GitHub token is needed. It has no runtime dependencies, so no other entry is needed. When the Packagist listing is live, the plain `composer require indianopinion/gen-queue` will work and the `repositories` entry can go. +and the plugin in `wp-content/plugins/gen-queue/`. Activate it there as usual. It has no runtime Composer dependencies and loads its own classes through `autoload.php`, so no other repository entry is needed. When the Packagist listing is live, the `repositories` entry can go. ## Quick start