magicoli/wp-package-updater-lib
Composer 安装命令:
composer require magicoli/wp-package-updater-lib
包简介
Composer package for wp-package-updater library.
README 文档
README
This is a set of all needed libraries to include in a plugin, to get automatic updates from Anexandre Froger's WP Plugin Update Server.
Requirements:
- WP Plugin Update Server must be installed and configured
- Your plugin must appear in WP Plugin Update Server packages list
- Composer must be configured (if not run
composer init --type=wordpress-pluginfrom your plugin root folder)
Install from command-line:
# Install package with composer composer require magicoli/wp-package-updater-lib # Add library to lib/wp-package-updater-lib php vendor/magicoli/wp-package-updater-lib/install.php # You should run install.php again each time the package is updated
To keep library up to date with composer update, insert this in composer.json:
"scripts": { "post-update-cmd": [ "php vendor/magicoli/wp-package-updater-lib/install.php" ] }
Include the following in your main plugin file:
// Adjust with your plugin uddate server URL $wppul_server = 'https://magiiic.com'; $wppul_licence_required = false; // optional, set to true if licence is set in WPPUS // Use autoload to load library require_once( __DIR__ . '/lib/package-updater.php' );
The $wppul_server variable will be unset by the library afterwards to prevent conflicts with any other plugin so it is not safe to use it for other purposes.
Original README
Description
Used to enable updates for plugins and themes distributed via WP Plugin Update Server.
Requirements
The library must sit in a lib folder at the root of the plugin or theme directory.
Before deploying the plugin or theme, make sure to change the following value:
https://your-update-server.com=> The URL of the server where WP Plugin Update Server is installed.$prefix_updater=> Change this variable's name with your plugin or theme prefix
Code to include in main plugin file
Simple update
require_once plugin_dir_path( __FILE__ ) . 'lib/wp-package-updater/class-wp-package-updater.php'; $prefix_updater = new WP_Package_Updater( 'https://your-update-server.com', wp_normalize_path( __FILE__ ), wp_normalize_path( plugin_dir_path( __FILE__ ) ), );
Update with license check
require_once plugin_dir_path( __FILE__ ) . 'lib/wp-package-updater/class-wp-package-updater.php'; $prefix_updater = new WP_Package_Updater( 'https://your-update-server.com', wp_normalize_path( __FILE__ ), wp_normalize_path( plugin_dir_path( __FILE__ ) ), true );
Code to include in functions.php
Simple update
require_once get_stylesheet_directory() . '/lib/wp-package-updater/class-wp-package-updater.php'; $prefix_updater = new WP_Package_Updater( 'https://your-update-server.com', wp_normalize_path( __FILE__ ), get_stylesheet_directory(), );
Update with license check
require_once get_stylesheet_directory() . '/lib/wp-package-updater/class-wp-package-updater.php'; $prefix_updater = new WP_Package_Updater( 'https://your-update-server.com', wp_normalize_path( __FILE__ ), get_stylesheet_directory(), true );
magicoli/wp-package-updater-lib 适用场景与选型建议
magicoli/wp-package-updater-lib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 149 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 06 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 magicoli/wp-package-updater-lib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 magicoli/wp-package-updater-lib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 149
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2023-06-07