afragen/add-plugin-dependency-api
最新稳定版本:0.4.8
Composer 安装命令:
composer require afragen/add-plugin-dependency-api
包简介
Library that helps WordPress plugin dependency management.
README 文档
README
- Contributors: Andy Fragen, contributors
- Tags: plugin dependency
- Requires at least: 6.0
- Requires PHP: 5.6
- Stable tag: main
- Donate link: https://thefragens.com/git-updater-donate
- License: MIT
Composer library for adding a plugin dependency response based upon use with Git Updater v12 or greater.
Description
This is an example to developers of non dot-org plugins that wish to take advantage of the Plugin Dependencies feature from the Requires Plugins header.
You can use composer to install this package within your WordPress plugin / theme.
Please ensure you are using the latest version of this framework in your composer.json
- Within your plugin or theme root folder, run the following command:
composer require afragen/add-plugin-dependency-api
- Add a filter to your plugin that requires a dependency that returns an array or JSON response containing a REST endpoint that returns a valid
plugins_api()response.
A query arg of the plugin slug, ?slug=my-plugin-dependency, will be passed to the endpoint returned from the filter. The slug originates from the Require Plugins header.
// Add the sites with REST enpoints that return plugins_api() data when passed `slug` query arg. // You can also return URL to a JSON file containing the appropriate data. add_filter( 'plugin_dependency_endpoints', function () { return [ 'https://git-updater.com/wp-json/git-updater/v1/plugins-api/' ]; } );
To see an example REST endpoint return view https://git-updater.com/wp-json/git-updater/v1/plugins-api/?slug=git-updater in the browser.
Development
PRs are welcome against the develop branch.
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-02