hotsource/wppm
Composer 安装命令:
composer require hotsource/wppm
包简介
Package Manager for WordPress
README 文档
README
#WPPM ##Composer-based package manager for WordPress This libraries simplifies dependency management for WordPress plugins (and soon themes).
When installed in a WordPress site, a WPPM-enabled plugin will automatically resolve conflicts with other Composer-based plugins.
If a plugin cannot be resolved, the user will be notified that there is a problem and instructed to either disable the plugin or talk to a developer to resolve it manually.
Why is something like WPPM required?
Unless you have a fully composer-enabled WordPress install (eg: roots.io/bedrock), plugins will attempt to load all of their dependencies. When two plugins include the same dependency (different versions), first-to-be-loaded wins.
If one of those plugins is not compatible with the loaded dependency, the site could completely break - or worse (IMO), it could not show any errors until a visitor attempt to do something that uses a missing feature.
How to use
To add Composer support to your plugin, you will need to do the following:
1 - Add hotsource/wppm to your required packages.
2 - Run composer install
3 - Add the following code snippet to autoload your plugin:
require_once __DIR__ . "/vendor/hotsource/wppm/wppm.php";
if ( ! WPPM::autoload( __FILE__ ) )
return;
Other notes
WPPM::autoload() will return a boolean value indicating whether or not your plugin successfully loaded all dependencies. If it returns false, it's best to simply "return;" as this would prevent your plugin from continuing to load. A notification about the issue will be shown in the WP Admin area.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GNU
- 更新时间: 2016-11-15