From 4d73226cdc3a61b9dff4f102b26523650e3ad295 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 27 Sep 2025 22:44:31 +0300 Subject: [PATCH 1/4] docs: add Composer-managed installation instructions --- docs/2.getting-started.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/2.getting-started.md b/docs/2.getting-started.md index a19927c..9e17169 100644 --- a/docs/2.getting-started.md +++ b/docs/2.getting-started.md @@ -29,13 +29,38 @@ wp plugin install https://github.com/WordPress/abilities-api/releases/latest/dow } ``` +#### In a Composer-managed WordPress installation + +```jsonc +// composer.json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/WordPress/abilities-api.git" + }, + // ... other non WP-Packagist repositories. + ], + "extra": { + "installer-paths": { + // This relative path should match your WordPress+Composer setup. + "wp-content/plugins/{$name}/": [ + "type:wordpress-plugin" + ] + // .. other paths. + } + } + // ... rest of your composer.json. +} +``` + ### As a dependency Plugin authors and developers may wish to rely on the Abilities API as a dependency in their own projects, before it is merged into core. You can do that in one of the following ways. -#### As a Plugin Dependency (Recommended) +#### As a Plugin Dependency -The best way to ensure the Abilities API is available for your plugins is to include it as one of your `Requires Plugins` in your [Plugin header](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/). For example: +The easiest way to ensure the Abilities API is available for your plugins is to include it as one of your `Requires Plugins` in your [Plugin header](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/). For example: ```diff # my-plugin.php @@ -49,7 +74,7 @@ The best way to ensure the Abilities API is available for your plugins is to inc */ ``` -While this is enough to ensure the Abilities API is loaded before your plugin, if you need to ensure specific version requirements or provide users guidance on installing the plugin, you can use the methods described [later on](#checking-availability-with-code) +While this is enough to prevent your plugin from being activated if the Abilities API plugin is not available, it does not install the plugin for you. If you need to ensure specific version requirements or provide users guidance on installing the plugin, you can use the methods described [later on](#checking-availability-with-code) #### As a Composer dependency From 37558faa21ff9497345ecb33d075445837c2501e Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 27 Sep 2025 22:53:46 +0300 Subject: [PATCH 2/4] docs: missing `require` command --- docs/2.getting-started.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/2.getting-started.md b/docs/2.getting-started.md index 9e17169..c6cd276 100644 --- a/docs/2.getting-started.md +++ b/docs/2.getting-started.md @@ -54,6 +54,12 @@ wp plugin install https://github.com/WordPress/abilities-api/releases/latest/dow } ``` +Then require the package in your project: + +```bash +composer require wordpress/abilities-api +``` + ### As a dependency Plugin authors and developers may wish to rely on the Abilities API as a dependency in their own projects, before it is merged into core. You can do that in one of the following ways. From ce14a5ced5bd461005c22de9bbe20e490e0cb032 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 27 Sep 2025 22:56:11 +0300 Subject: [PATCH 3/4] docs: fix alignment --- docs/2.getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/2.getting-started.md b/docs/2.getting-started.md index c6cd276..7c101a2 100644 --- a/docs/2.getting-started.md +++ b/docs/2.getting-started.md @@ -45,7 +45,7 @@ wp plugin install https://github.com/WordPress/abilities-api/releases/latest/dow "installer-paths": { // This relative path should match your WordPress+Composer setup. "wp-content/plugins/{$name}/": [ - "type:wordpress-plugin" + "type:wordpress-plugin" ] // .. other paths. } From bb8819a0bac971e94def03a74b9e82def66445d2 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 27 Sep 2025 22:57:15 +0300 Subject: [PATCH 4/4] fix: capital WPackagist dangit --- docs/2.getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/2.getting-started.md b/docs/2.getting-started.md index 7c101a2..417dfa2 100644 --- a/docs/2.getting-started.md +++ b/docs/2.getting-started.md @@ -39,7 +39,7 @@ wp plugin install https://github.com/WordPress/abilities-api/releases/latest/dow "type": "vcs", "url": "https://github.com/WordPress/abilities-api.git" }, - // ... other non WP-Packagist repositories. + // ... other non-WPackagist repositories. ], "extra": { "installer-paths": {