Skip to content
Open
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
37 changes: 34 additions & 3 deletions docs/2.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,44 @@ 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-WPackagist 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.
}
```

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.

#### 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
Expand All @@ -49,7 +80,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

Expand Down